Assuming flex-direction: row
and that three <div></div>
elements fit on one line, is it possible for the browser to display 2 on each line, for two lines, instead of displaying 3 on one line, and then 1 on the next?
Implicit in that statement is that each of the divs is equal to or less than 1/3 width of a complete row.
Thus normally your result would be say....
#flex {
display: flex;
flex-wrap: wrap;
background: orange;
}
#flex div {
border: 1px solid white;
height: 100px;
width: 33%;
background: rebeccapurple;
}
<div id="flex">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
However, from the request you seem to wish to break the line/row after the second element.
As explained by @Oriol here this can only be done by either changing the structure or using clever methods to insert either invisible actual or pseudo-elements to force a linebreak.
For example:
#flex {
display: flex;
flex-wrap: wrap;
background: orange;
justify-content: space-around;
}
#flex div {
border: 1px solid white;
height: 100px;
width: 33%;
background: rebeccapurple;
}
#flex::before {
content: "";
width: 100%;
order: 1;
}
div:nth-child(n + 3) {
order: 2;
}
<div id="flex">
<div></div>
<div></div>
<div></div>
<div></div>
</div