I've played around with responsive flexbox grids, with no media queries.
http://jsbin.com/qurumisu/1 (rescale the window to see how it works)
It fits as many flex items as it can per row and stretches their width equally to fill the whole line. However, this doesn't help "orphan" items. If the first line fits 5/6 items there is only one left for the second line, making it stretch much wider than it's siblings. I would prefer to avoid this behavior by having the elements divided evenly on the amount of rows required.
Is this possible?
For 3 items per row, add on the flex items: flex-basis: 33.333333% You can also use the flex 's shorthand like the following: flex: 0 0 33.333333% => which also means flex-basis: 33.333333% .
The flex-wrap CSS property sets whether flex items are forced onto one line or can wrap onto multiple lines.
And then to have equally sized columns you will have to set the flex-grow property of every child to "1", or you can also use the shorthand "flex:1". The text-align property is what I'm using here to center your text and your images inside each column.
No, not without media queries adjusting the flex-basis value. Flex items that stretch and wrap attempt to maximize the amount of items that fit on each row.
You may want to consider using the multi-column module instead, which will attempt to equally distribute elements across all of the columns created:
.foo { columns: 100px; }
http://caniuse.com/#feat=multicolumn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With