The impact caused by floating

After the float element is added, will be in a state of semi departing document stream, if not set to a fixed height of the floating element of the parent element, the parent element will be that there is no distraction own content, so the height of the parent element is 0, then the following element to the meeting, to be pressed below the floating element.

solution:

1. to set a fixed height of the parent element (parent element will be inflexible, we can not rely on the contents of the Free Transform distraction height)

2. Give the parent element is set overflow: hidden (though to avoid floating the impact, but there are other effects that style, that is, beyond the hidden part of the contents)

3. element arranged to clearfix pseudo-classes, defined below styles, and then add clearfix parent element of the class

 

Guess you like

Origin www.cnblogs.com/NIFS/p/12606957.html