Clear floating elements about CSS

(1): Definition of floating : Make the element out of the document flow, move in the specified direction, and stop when it encounters the parent boundary or the adjacent floating element Down.
(2): height collapse: floating element parent Element height adaptation (when the parent element does not write the height, the parent element will collapse in height after the child element is written to float)
Universal clear floating:
selector:after {
content:”.”;
clear:both;
display:block;
height:0;
overflow:hidden;
visibility:hidden;
}

(1): definition of float: make The element leaves the document flow, moves in the specified direction, and stops when it encounters the parent boundary or the adjacent floating element.

(2): Height collapse: The height of the parent element of the floating element is adaptive (when the parent element does not write the height, the height of the parent element will collapse after the child element writes the float)

Universal clear float:

Selector:after{

content:”.”;

< p> clear:both;

display:block;

height:0;

overflow :hidden;

visibility:hidden;

}

Leave a Comment

Your email address will not be published.