梗概
示例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
.warp {
background-color: red;
border-radius: 20px;
border-style: solid;
border-width: 10px;
border-color: green;
box-sizing: border-box;
}
.a {
background-color: blue;
float: left;
width: 100px;
height: 100px;
}
.b {
background-color: yellow;
float: left;
width: 200px;
height: 150px;
}
.c {
background-color: hotpink;
border: 10px solid darkcyan;
height: 110px;
width: 100px;
overflow: hidden; /* 设置为BFC */
}
</style>
<body>
<div class="warp">
<div class="a">aaaaa</div>
<div class="b">bbbbb</div>
<div class="c">ccccc</div>
</div>
</body>
</html>设置成BFC的前后效果对比:

