1、CSS中的clear有四个参数:

none:允许两边都可以浮动。

left:不允许左边有浮动。

right:不允许右边有浮动。

both(默认);不允许有浮动。

2、一开始在CSS中clear浮动是默认both,也就是说一开始不能有浮动的。

3、使用的案例:假设我清除第三个DIV的浮动

XML/HTML Code复制内容到剪贴板 <style type="text/css">   div{    border:1px solid red;    float:left;    clear:none;    }    #msg_Div{    width:600px;    height:600px;    }    .one{    width:100px;    height:90px;    }    .two{    width:100px;    height:90px;    }    .three{    width:100px;    height:90px;    clear:left;    }    .four{    width:100px;    height:90px;    }    .five{    width:100px;    height:90px;    }    </style>              <body>   <div id="msg_Div">   <div class="one"></div>   <div class="two"></div>   <div class="three"></div>   <div class="four"></div>   <div class="five"></div>   </div>   </body>  

效果:

   

以上这篇浅谈CSS中的clear清除浮动就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

浅谈CSS中的clear清除浮动