Let's talk about the common methods for clearing floating, and the common methods for clearing floating.
When we do page layout, we often need to use floating to achieve some layout effects. This will cause the parent element to lose its width. Today we will talk about the method of 'retrievation.
The effect after the floating point is cleared is as follows:
The following describes the methods. There are actually many methods. For details about the following methods, refer
(1) The parent div defines the height.
(2) Add the empty div label clear: both at the end.
(3) parent div defines pseudo classes: after and zoom.
(4) parent div defines overflow: hidden.
(5) parent div defines overflow: auto.
(6) The parent div also floats and the width needs to be defined.
(7) parent div defines display: table.
(8) Add the br label clear: both at the end.
Generally, it is better to add a pseudo element after to the parent element. As shown in the following figure:
(For more information, see here)