清除浮动的三种方法
1、
<div class="clear"></div> .clear { clear: both; }
2、
<div class="container clearfix">
<div class="div1">333</div>
<div class="div1">333</div>
<div class="div1">333</div>
</div>
<div class="div2">9999</div> .clearfix:after { content: "."; display: block; height: 0; visibility: hidden; clear: both; } .clearfix { zoom: 1; /* 触发hasLayout 兼容IE 6、7 */ }
3、
<div class="container"> <div class="div1">333</div> <div class="div1">333</div> <div class="div1">333</div> </div> <div class="div2">9999</div> .container { width: 500px; overflow: hidden;
zoom: 1; } .div1 { float: left; width: 100px; height:100px; } .div2 { width: 500px; height: 200px; }
略懂,略懂....