There are two methods commonly used
overflow
Overflow elements used within parent: hidden attributes, sub-elements to clear float
Do not use overflow: when hidden:
Blue ul, li float because pink, and blue pink ul li hold up losing height, therefore shrink up
Use overflow: when hidden:
Pseudo-class: after
This is a more commonly used method, pseudo-classes may be added to the parent element to clear the float. But there is a better way,
A pseudo class defined directly added to the parent element. Here the reference to bilibili class clearfix
In fact, this principle is to use an empty label use clear: both to clear the float. Pseudo-class: after final will load a label within the last position of elements, of course, you can also be defined directly on the parent class: after pseudo-class.
eq: