【发布时间】:2017-08-07 21:10:58
【问题描述】:
* {
margin: 0;
padding: 0;
}
.cnt {
display: flex;
margin: 50px;
background: #ffff00;
justify-content: space-between;
flex-wrap: wrap;
}
.cnt div {
width: 100px;
height: 100px;
background: #999;
margin: 10px;
}
.cnt::after {
content: '';
width: 100%;
}
.flex-item:nth-child(6) {
order: 1;
}
<div class="cnt">
<div class="flex-item one"></div>
<div class="flex-item two"></div>
<div class="flex-item three"></div>
<div class="flex-item four"></div>
<div class="flex-item five"></div>
<div class="flex-item six"></div>
</div>
我遇到的问题是我只能在最后一项上断线......我实际上如何能够在我想要的时候刹车线?比如我想在.two课后换行,怎么办?
编辑
我是个白痴。这是实际上你是怎么做的。你只需要传递你想在下一个order中的项目。显然你只能这样做一次。
因此,要在第二个框中换行,您需要将.three、.four、.five 和.six 传递给order: 1。见这里:https://jsfiddle.net/r33muub3/4/
我将justify-content 更改为left,这样会更明显
【问题讨论】:
-
@Fran 谢谢,我忘了添加 jsfiddle 的链接:jsfiddle.net/r33muub3