我有我的第一,第二和第三项,然后无论空间有多宽,我都希望第四项进入下一行。
.box {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
align-items: flex-start;
}
.it {
max-width: 420px;
}

<div class="box">
<div class="it">1</div>
<div class="it">2</div>
<div class="it">3</div>
<div class="it">4</div>
</div>
&#13;
答案 0 :(得分:36)
您可以在正确的位置插入一个宽的伪元素:
.flex-container {
display: flex;
flex-wrap: wrap;
}
.flex-container::after {
content: '';
width: 100%;
}
.flex-item:last-child { /* or `:nth-child(n + 4)` */
order: 1;
}
<div class="flex-container">
<div class="flex-item">1</div>
<div class="flex-item">2</div>
<div class="flex-item">3</div>
<div class="flex-item">4</div>
</div>
答案 1 :(得分:0)
我通过以下方法解决了这个问题:
.flex-container{
display:flex;
flex-direction:column;
/* how you want your lines */
text-align:center;
}
<div class="flex-container">
<p>Line1</p>
<p>Line2</p>
</div>