三列布局
两列定宽,一列自适应
float
使用 float+margin 实现
<div class="wrapper">
<div class="left"></div>
<div class="main"></div>
<div class="rigth"></div>
</div>
.wrapper {
height: 400px;
background: red;
min-width: 500px;
}
.left {
margin-left: 10px;
float: left;
width: 100px;
height: 100%;
background-color: #0f0;
}
.main {
float: left;
width: 100px;
height: 100%;
margin-left: 20px;
background: brown;
}
.rigth {
margin-left: 230px; /*等于#left和#center的宽度之和加上间隔,多出来的就是#right和#center的间隔*/
height: 100%;
background-color: blue;
}
flex
要点:第二个子元素添加margin-left:auto
预览链接:三元素两列布局