拥有一个代表3列网格并使用justify-content: space-around
属性的flexbox容器,我们如何处理最后一个元素或第一个元素,它们只代表2或1个盒子/盒子与左边?
Here是重现我的问题的一个例子:
.flex-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-pack: distribute;
justify-content: space-around;
}
.flex-container .flex-box {
display: block;
height: 250px;
max-width: 360px;
-ms-flex-preferred-size: 360px;
flex-basis: 360px;
background-color: red;
padding: 15px;
margin-bottom: 30px;
}
<div class="flex-container">
<div class="flex-box"></div>
<div class="flex-box"></div>
<div class="flex-box"></div>
<div class="flex-box"></div>
<div class="flex-box"></div>
<div class="flex-box"></div>
<div class="flex-box"></div>
</div>