我想知道如何打破flex
行并开始新行。我希望display:flex
可以打破它,但事实并非如此。
.dflex {
display:flex;
}
.flexitem {
flex:6;
}
/* irrelevant styles */
.dflex {
border:2px solid red;
margin:4px;
}
.flexitem {
border:2px solid black;
margin:4px;
}

<div class="dflex">
<div class="flexitem">
</div>
<div class="flexitem">
</div>
<div class="dflex">
<div class="flexitem">
</div>
</div>
</div>
&#13;
答案 0 :(得分:1)
您可以将flex-wrap: wrap;
和width: 100%;
添加到.dflex
课程。
.dflex {
display:flex;
flex-wrap: wrap;
width: 100%;
border:2px solid red;
margin:4px;
}
.flexitem {
border:2px solid black;
margin:4px;
flex: 6;
}
&#13;
<div class="dflex">
<div class="flexitem">
</div>
<div class="flexitem">
</div>
<div class="dflex">
<div class="flexitem">
</div>
</div>
</div>
&#13;