I know I can define how a flexbox behaves using flex-wrap
and defining width to my child objects using flex-grow
.
But what can I use to break the flow of one line at a specific point?
X X X X <br>
X X <br>
X X X X
I know I can define how a flexbox behaves using flex-wrap
and defining width to my child objects using flex-grow
.
But what can I use to break the flow of one line at a specific point?
X X X X <br>
X X <br>
X X X X
Here's one method:
Make your flex container flex-direction: column
Make each flex item a nested flex container with flex-direction: row
.
Now you have a primary flex container that will create a new row whenever a flex item is added.
Each of these flex items is also a flex container with horizontally aligned flex items.
To emulate the illustration in the question...
X X X X <br>
X X <br>
X X X X
... the first flex item would contain four nested items, the second row would have two items and the third row would have four.
The break occurs anytime you add a flex item to the main container.