CSS Clear

In CSS, the clear property is used to control the behavior of an element that follows a floated element. Specifically, it ensures that the element appears below any preceding floated elements, rather than wrapping around them.


Syntax:

clear: none | left | right | both | inherit;
Example
.div3 {
padding: 10px;
border: 3px solid red;
clear: left;
}

Try it yourself

Clearfix:

When working with layouts where floated elements are inside a parent container, clear can be useful to ensure the container expands to fit its floated children.

Example
.clearfix::after {
content: "";
clear: both;
display: table;
}

Try it yourself


Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.