If you let a parent element wrap a floating child element? There are several ways to do this:
1: Let the parent element also float together: tested the method is feasible, and all around, very tight. But if the current child element has more than one parent,
Then each parent element should be set to float, or even write to the <body>, so the method pass.
2. Set overflow hidden property for parent element: also can implement requirements, but this method has many compatibility issues, you can open several browser test after class
3. Add an empty block element to the current parent element, and this new element only does one thing, clearing the floating elements around it
Testing can also achieve the requirements, this method is the simplest and most intuitive, and there is no compatibility problem, but there is a fatal problem,
That is to add a useless element to the current list of child elements, which can be cumbersome when we use JavaScript and PHP to traverse the data in a scripting language.
Because this element is not what we need and must be dealt with separately, is there a solution to the beauty of the two: to ensure compatibility without adding new elements?
There, with the pseudo-elements we've learned before.
4. Add to the parent element: after pseudo-class, after adding an empty element, directly set its properties;