Update format

This commit is contained in:
Angelos Chalaris
2020-04-30 13:21:04 +03:00
parent d9fd2d23c3
commit 2fbd3e0737
55 changed files with 412 additions and 571 deletions

View File

@ -5,6 +5,11 @@ tags: layout,beginner
Ensures that an element self-clears its children.
- `.clearfix:after` defines a pseudo-element.
- `content: ''` allows the pseudo-element to affect layout.
- `clear: both` indicates that the left, right or both sides of the element cannot be adjacent to earlier floated elements within the same block formatting context.
- This is only useful if you are still using `float` to build layouts. Please consider using a modern approach with flexbox layout or grid layout. For this snippet to work properly you need to ensure that there are no non-floating children in the container and that there are no tall floats before the clearfixed container but in the same formatting context (e.g. floated columns).
```html
<div class="clearfix">
<div class="floated">float a</div>
@ -24,10 +29,3 @@ Ensures that an element self-clears its children.
float: left;
}
```
#### Explanation
- `.clearfix:after` defines a pseudo-element.
- `content: ''` allows the pseudo-element to affect layout.
- `clear: both` indicates that the left, right or both sides of the element cannot be adjacent to earlier floated elements within the same block formatting context.
- This is only useful if you are still using `float` to build layouts. Please consider using a modern approach with flexbox layout or grid layout. For this snippet to work properly you need to ensure that there are no non-floating children in the container and that there are no tall floats before the clearfixed container but in the same formatting context (e.g. floated columns).