两块内容
<div class="box">
<div class="left"></div>
<div class="right"></div>
</div>
1、左边宽度固定,右边宽度自适应铺满
.box {
display:flex;
height:100%;
width:100%;
}
.left {
height:100%;
width: 300px;
background-color: #999;
}
.right {
height:100%;
flex: 1;
background-color: #333;
}
2.上面高度固定,下面高度自适应铺满
.box {
display:flex;
height:100%;
width:100%;
flex-direction: column;
}
.left {
height:200px;
width: 100%;
background-color: #999;
}
.right {
width:100%;
flex: 1;
background-color: #333;
}
三块内容
<div class="box">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
上下固定高度,中间自适应铺满
.box {
display:flex;
height:100%;
width:100%;
flex-direction: column;
}
.left {
height:200px;
width: 100%;
background-color: #999;
}
.center {
width:100%;
flex: 1;
background-color: #333;
}
.right{
height:200px;
width: 100%;
background-color: #12aa23;
}
左右固定宽度,中间自适应铺满
.box {
display:flex;
height:100%;
width:100%;
}
.left {
width:200px;
height: 100%;
background-color: #999;
}
.center {
height:100%;
flex: 1;
background-color: #333;
}
.right{
width:200px;
height: 100%;
background-color: #12aa23;
}
因篇幅问题不能全部显示,请点此查看更多更全内容