How to break line in a flex layout?
I have solved this by:
.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>
You can insert a wide pseudo-element at the right position:
.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>