1 回答

TA貢獻1777條經驗 獲得超3個贊
你想要flex-direction: column和flex-wrap:wrap。然后給你的物品高度,以便它們垂直包裹在容器內:
html,body{height:100%;}
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
border: solid 2px orangered;
width: 50%;
height: 60%;
box-sizing:border-box;
}
.item {
box-sizing:border-box;
margin: 2px;
}
.one {
height: calc(33% - 4px);
border: solid 2px green;
width: calc(65% - 4px);
}
.two {
height: 40%;
border: solid 2px orange;
width: calc(35% - 4px);
}
<div class="container">
<div class=" item one ">one</div>
<div class="item one ">one</div>
<div class="item one ">one</div>
<div class="item two ">two</div>
<div class="item two ">two</div>
</div>
- 1 回答
- 0 關注
- 206 瀏覽
添加回答
舉報