<style>
.box1{
background-color: red;
width: 800px;
/* 法一 */
/* overflow:hidden; */
/* 法三 */
zoom: 1;
}
.box2{
background-color: green;
width: 100px;
height: 100px;
float:right;
}
/* 法二 */
.box3{
clear: both;
}
/* 法三 */
.box1::after{
content: '';
height: 0;
line-height: 0;
display: block;
visibility: hidden;
clear: both;
}
</style>
<div class="box1">
<div class="box2"></div>
<!-- <div class="box3"></div> -->
</div>
bfc清除浮动
最新推荐文章于 2024-02-01 23:00:41 发布