码迷,mamicode.com
首页 > Web开发 > 详细

CSS3中三种清除浮动(float)的方法

时间:2016-05-23 21:15:24      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:

方法一:添加新的元素 、应用 clear:both

.clear{
   clear:both; 
   height: 0; 
   height: 0; 
   overflow:hidden;
}

 

方法二:父级div定义 overflow: auto

.over-flow{
    overflow: auto; 
    zoom: 1; //处理兼容性问题
}

 

方法三: 伪类  :after 方法  outer是父div的样式

.outer {zoom:1;}    /*==for IE6/7 Maxthon2==*/
.outer :after {
   clear:both;
   content:‘.‘;
   display:block;
   width: 0;
   height: 0;
   visibility:hidden;
}

 

CSS3中三种清除浮动(float)的方法

标签:

原文地址:http://www.cnblogs.com/programs/p/5521211.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!