清除浮动

 

https://segmentfault.com/a/1190000015960009

利用:after伪选择符,在父容器的尾部自动创建一个子元素

.clearfix:after {
    content: "";
    display: block;
    clear: both;
}
//兼容ie6:激活父元素的"hasLayout"属性,让父元素拥有自己的布局
.clearfix {
    zoom: 1;  //或者height:1%;
}

 

posted on 2019-10-07 22:24  songsong_p_blue  阅读(111)  评论(0编辑  收藏  举报