码迷,mamicode.com
首页 > 其他好文 > 详细

清除浮动

时间:2016-11-21 19:36:02      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:oom   元素   浮动   nbsp   hid   clear   清除浮动   over   display   

1.1   清除浮动

 清除浮动: 根据情况需要来清楚浮动 。

 清除浮动的目的: 就是为了解决 父 盒子高度为0 的问题。

 清除浮动:

    1. 额外标签法  

    2. Overflow: hidden   触发 bfc 模式 就不用清楚浮动

    3. 伪元素 

    .clearfix:after {

          content:””;

          Visibility:hidden; 

          Display:block;

          Height:0;

          Clear:both;

     }

    .clearfix{

      Zoom:1;

}

 清除浮动:  真正的叫法  闭合浮动

   4. 双伪元素

.clearfix:before,.clearfix:after{
    display: table;
    content: "";
}
.clearfix:after {
    clear: both;
}
.clearfix {
    zoom: 1;
}

清除浮动

标签:oom   元素   浮动   nbsp   hid   clear   清除浮动   over   display   

原文地址:http://www.cnblogs.com/zhaobw/p/6085949.html

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