添加伪类,空标签clear: both
.clearfix::after {
content: '';
clear: both;
display: block;
}
.clearfix {
zoom: 1 // IE问题兼容
}
position 设置为非 static 和relative
脱离文档流
clear: both
.clearfix::after {
content: '';
clear: both;
display: block;
}
.clearfix {
zoom: 1 // IE问题兼容
}
脱离文档流
本文标题:【css】清除浮动有哪些方式
本文链接:https://www.haomeiwen.com/subject/hxaxsltx.html
网友评论