这是公共代码
* {
margin: 0;
padding: 0;
}
.left {
background-color: blueviolet;
width: 300px;
}
.right {
background-color: yellow;
width: 300px;
}
.center {
background-color: red;
}
.left,
.right,
.center {
height: 200px;
}
方法一:BFC
<div class="box">
<div class="left"></div>
<div class="right"></div>
<div class="center">
左右float固定,中间设置bfc(overflow:auto;width:auto)
</div>
</div>
.left {
float: left;
}
.right {