.clearfix:after{
visibility:
hidden;
display:
block;
font-size:
0;
content:
"\20";
clear:
both;
height:
0;}
* html .clearfix{
zoom:
1;}
/* IE6 */
.clear{
clear:
both;}
:first-child+html .clearfix{
zoom:
1;}
/* IE7 */
.clearfix{
zoom:
1;}
使用方法:在浮动层的外层调用clearfix样式
clear:both;
或者在浮动层下加:div样式添加上一个样式
转载于:https://www.cnblogs.com/daixingqing/archive/2012/12/08/2809003.html
相关资源:浮动从何而来 我们为何要清除浮动 清除浮动的原理是什么