清浮动早就是个页面布局的大问题了,在网上也有很多关于清浮动的案例。这里我要提到的是一个比较完美的清除浮动的方法,废话不多说,直接上代码:
css代码:
<style>
.clearfix:after{
visibility: hidden;
display: block;
font-size: 0;
content: ".";
clear: both;
height: 0;
*zoom: 1;
}
</style>
html代码:
<div class="clearfix" style="border: 2px solid red;">
<div style="float: left; width: 80px; height: 80px; border: 1px solid blue;">
测试测试
</div>
</div>