zoom: 1;/*在IE下触发其layout,也要以使用_height:1%来代替zoom*/
}</pre><p></p>
<p style=”margin-top:0px; margin-bottom:9px; color:rgb(64,64,64); font-family:’Microsoft Yahei’; line-height:28px”>
<span style=”white-space:pre”></span>使用overflow属性来清除浮动有一点需要注意,overflow属性共有三个属性值:hidden,auto,visible。我们可以使用hiddent和auto值来清除浮动,但切记不能使用visible值,如果使用这个值将无法达到清除浮动效果,其他两个值都可以。</p>
<p style=”margin-top:0px; margin-bottom:9px; color:rgb(64,64,64); font-family:’Microsoft Yahei’; line-height:28px”>
<span style=”white-space:pre”></span>对于overflow属性清滁浮动我们还可以这样应用:</p>
<p style=”margin-top:0px; margin-bottom:9px; color:rgb(64,64,64); font-family:’Microsoft Yahei’; line-height:28px”>
</p><pre name=”code” class=”css”> .A {
overflow: auto;/*除IE6以及其以下版本不识别之外,其他浏览器都识别*/
}
* html .A {
height: 1%; /* IE5-6 */
}</pre><p></p>
<h4 style=”margin:0px; line-height:30px; color:rgb(81,177,72); font-family:’Microsoft Yahei'”><a name=”t2″></a>
<span style=”white-space:pre”></span>3.clearfix方法</h4>
<p style=”margin-top:0px; margin-bottom:9px; color:rgb(64,64,64); font-family:’Microsoft Yahei’; line-height:28px”>
<span style=”white-space:pre”></span>这种方法清除浮动是现在网上最拉风的一种清除浮动,是利用:after和:before来在元素内部插入两个元素块,从而达到清除浮动的效果。其实现原理类似于clear:both方法,只是区别在于:clear在html插入一个div.clear标签,而clearfix利用其伪类clear:fix在元素内部增加一个类似于div.clear的效果。下面来看看其具体的使用方法:</p>
<p style=”margin-top:0px; margin-bottom:9px; color:rgb(64,64,64); font-family:’Microsoft Yahei’; line-height:28px”>
HTML Code:</p>
<p style=”margin-top:0px; margin-bottom:9px; color:rgb(64,64,64); font-family:’Microsoft Yahei’; line-height:28px”>
</p><pre name=”code” class=”css”> <div class=”demo A clearfix”>
<div class=”demoB demoFloat”>float left</div>
<div class=”demoC demoFloat”>float right</div>
<div class=”demoD demoFloat”>not float</div>
</div></pre><p></p>
<p style=”margin-top:0px; margin-bottom:9px; color:rgb(64,64,64); font-family:’Microsoft Yahei’; line-height:28px”>










