1.overflow:hidden
2.利用伪元素
div::after {
display: block;
content: "";
clear: both;
}
3.添加一个div
<style>
.cf {
clear: both;
}
</style>
<div>
.......
.......
<div class="cf"></div>
</div>
div::after {
display: block;
content: "";
clear: both;
}
<style>
.cf {
clear: both;
}
</style>
<div>
.......
.......
<div class="cf"></div>
</div>
本文标题:父容器高度塌陷的三种解决方法
本文链接:https://www.haomeiwen.com/subject/ocnwzttx.html
网友评论