<HTML><Head><title></title>
<style type= "Text/css" >
*{margin:0; padding:0;}
. content{
border:1px solid red;
}
. Fl{float:left}
</style>
</Head><Body><Div class= "content"><div class= "FL" >1</div><div class= "FL" >2</div></Div></Body></HTML>
The results are as follows:
Class has a float property that is out of normal document flow, so the parent element is equivalent to no normal document flow fill. With a height of 0, we want the parent node to be highly adaptive to the height of the float element.
Add Overflow:hidden to the parent element; When the box containing float, the height of automatic adaptation in IE invalid, this time should trigger the layout of IE private property (evil ie Ah!). ) with zoom:1, can be done, so that the compatibility is achieved. For example a certain wrapper is defined as follows:. content{Overflow:hidden; zoom:1; margin:5px Auto;}
CSS Float Parent Element highly adaptive