Flexbox has no easy way of rendering items with a column
layout while using a row
order, but we can build a masonry layout with CSS only—no JavaScript needed—by using :nth-child()
and the order
property.
This CSS-only way of creating a masonry (or mosaic) layout is surely not as robust, flexible, and foolproof as a JavaScript implementation (like Masonry) but if you don’t want to rely on a third-party library just to create a masonry layout I hope that these layouts tricks can come in handy.
Read Article