<div class="demo">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
複製代碼
.demo{
position:relative;
width:100%;
height:300px;
}
.left,.right{
position:absolute;
top:0;
width:100px;
height:300px;
}
.left{
left:0;
background:red;
}
.right{
right:0;
background:blue;
}
.center{
padding:0 100px;
height:300px;
background:green;
}
複製代碼
<div class="demo">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>
複製代碼
.demo{
width:100%;
height:300px;
}
.left,.right{
width:100px;
height:300px;
}
.left{
float:left;
background:red;
}
.right{
float:right;
background:blue;
}
.center{
padding:0 100px;
height:300px;
background:green;
}
複製代碼
<div class="demo">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
複製代碼
.demo{
width:100%;
height:300px;
display:flex;
}
.left,.right{
width:100px;
height:300px;
}
.left{
background:red;
}
.right{
background:blue;
}
.center{
padding:0 100px;
height:300px;
background:green;
flex:1;
}
複製代碼
<div class="demo">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
複製代碼
.demo{
width:100%;
height:300px;
display: grid;
grid-template-rows: 100px;
grid-template-columns: 100px auto 100px;
}
.left,.right{
width:100px;
height:300px;
}
.left{
background:red;
}
.right{
background:blue;
}
.center{
padding:0 100px;
height:300px;
background:green;
}
複製代碼
除了以上四種,還有雙飛燕、聖盃佈局。你們還有什麼其餘的方法嘛css