清除浮动

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;
}
原文地址:https://www.cnblogs.com/zhaobw/p/6085949.html