Update snippet to match guidelines
This commit is contained in:
@ -1,10 +1,11 @@
|
|||||||
### Focus Within
|
### Focus Within
|
||||||
|
|
||||||
The psuedo class `:focus-within` applies styles to a parent element if any child element gets focused. For example, an `input` element inside a `form` element.
|
Changes the appearance of a form if any of its children are focused.
|
||||||
|
|
||||||
#### HTML
|
#### HTML
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
<div class="focus-within">
|
||||||
<form>
|
<form>
|
||||||
<label for="given_name">Given Name:</label>
|
<label for="given_name">Given Name:</label>
|
||||||
<input id="given_name" type="text">
|
<input id="given_name" type="text">
|
||||||
@ -12,7 +13,7 @@ The psuedo class `:focus-within` applies styles to a parent element if any child
|
|||||||
<label for="family_name">Family Name:</label>
|
<label for="family_name">Family Name:</label>
|
||||||
<input id="family_name" type="text">
|
<input id="family_name" type="text">
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### CSS
|
#### CSS
|
||||||
@ -28,7 +29,6 @@ form:focus-within {
|
|||||||
background: #f7b731;
|
background: #f7b731;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Demo
|
#### Demo
|
||||||
@ -37,7 +37,7 @@ form:focus-within {
|
|||||||
|
|
||||||
#### Explanation
|
#### Explanation
|
||||||
|
|
||||||
<!-- Use a step-by-step (ordered) list if possible. Keep it concise. -->
|
The psuedo class `:focus-within` applies styles to a parent element if any child element gets focused. For example, an `input` element inside a `form` element.
|
||||||
|
|
||||||
#### Browser support
|
#### Browser support
|
||||||
|
|
||||||
@ -48,4 +48,4 @@ If no link is provided, it defaults to 99+%. -->
|
|||||||
|
|
||||||
- https://caniuse.com/#feat=css-focus-within
|
- https://caniuse.com/#feat=css-focus-within
|
||||||
|
|
||||||
<!-- tags: (separate each by a comma) -->
|
<!-- tags: visual, interactivity -->
|
||||||
|
|||||||
Reference in New Issue
Block a user