一个老外弄的Clearing floats(清除浮动的方法)
摘要:我常用的都是clear:both;方法,如今在PlanABC看到另外这种方法,特些记录下来。div.container{border:1px...
我常用的都是clear:both;方法,如
<divstyle="clear:both">
<divstyle="float:left"></div>
<divstyle="float:right"></div>
</div>
今在PlanABC看到另外这种方法,特些记录下来。
div.container{
border:1pxsolid#000000;
}
div.left{
width:45%;
float:left;
}
div.right{
width:45%;
float:right;
}
层套关系:container的div包含left和right
最简单合理的清除浮动的方法(红色粗体部分):
div.container{
border:1pxsolid#000000;
overflow:hidden;
width:100%;
}
兼容情况:IE6IE7FFMacIE等
来源地址:http://www.quirksmode.org/css/clearing.html
PS:不过在使用的过程貌似还有小的BUG,淘宝的小马曾碰到过,具体的症状是,IE6中层套清除浮动的div,导致部分链接无法点击。
【一个老外弄的Clearing floats(清除浮动的方法)】相关文章:
★ .clearfix:after(清除浮动)中各个属性及值详细解说
★ CSS兼容IE6、IE7、IE8和Firefox浏览器的方法
上一篇:
网页编辑中CSS样式表技巧总结