1.两侧固定,中间自适应


.box{
    width: 100%;
    display: flex;
    height: 300px;
}
.left{
    width: 100px;
    height: 200px;
    background-color:red;
}
.right{
    width: 100px;
    height: 200px;
    background-color:red;
}
.center{
    flex: 1;
    height: 300px;
    background-color: lime;
}

 

<body>
        <div class="box">
         <div class="left"></div>
        <div class="center"></div>
         <div class="right"></div>
        </div>
 

2.左侧固定,右侧自适应

.box{
    width: 100%;
    display: flex;
    height: 300px;
}
.left{
    width: 100px;
    height: 200px;
    background-color:red;
}
.right{
    flex: 1;
    height: 300px;
    background-color:lime;
}



<div class="box">
<div class="left"></div>
<div class="right"></div>
</div>

 

posted on 2019-09-24 21:47  宅到深夜  阅读(28968)  评论(0编辑  收藏  举报