清除浮动

【CSS】【清除浮动】
方法一:在底部插入clear:both
1.HTML block水平元素放置于底部 <div ...></div>
2.CSS after伪元素在底部生成 .clearfix:after{}
方法二:父元素BFC(IE8+)或haslayout(IE6/IE7)
float:left/right
position:absolute/fixed
overflow:hidden/scroll(IE7+)
display:inline-block/table-cell(IE8+)
width/height/zoom:1/...(IE7/IE7)
由于以上两个方法各有缺点所以:
权衡后的策咯
.clearfix:after{content:''; display:block; height:0; overflow:hidden; clear:both;}(IE8+)
.clearfix{*zoom:1;} (IE6/IE7)
或
.fix:after{}
.fix{}
更好的方法:
.clearfix:after{content:''; display:table; clear:both;}(IE8+)
.clearfix{*zoom:1;} (IE6/IE7)
切勿滥用
.clearfix只应用在包含浮动子元素的『父级元素』上
原文地址:https://www.cnblogs.com/lixiaodong86171/p/5979650.html