【转载】那些年我们一起清除过的浮动demo

返回文章:那些年我们一起清除过的浮动

闭合浮动 与 清除浮动 的区别

.main:很抱歉,现代浏览器中我没能把warp撑高(float:left)
.side:我也浮动了(float:left)
.main:warp自己闭合浮动了,所以footer不用再清除浮动了(float:left)
.side:我也浮动了(float:left)

闭合浮动的几种方法

1)添加额外标签

.main{float:left;}
.side{float:right;}
 

2)使用 br标签和其自身的 html属性

.main{float:left;}
.side{float:right;}

3)父元素设置 overflow:hidden

.main{float:left;}
.side{float:right;}

6)父元素设置display:table

.main{float:left;}
.side{float:right;}

 转自:http://www.iyunlu.com/demo/enclosing-float-and-clearing-float/index.html

原文地址:https://www.cnblogs.com/hycms/p/3895913.html