I have 5 items which run down the page on mobile:
<div class="flex flex-wrap flex-row">
<div class="order-1">item 1</div>
<div class="order-2">item 2</div>
<div class="order-3">item 3</div>
<div class="order-4">item 4</div>
<div class="order-5">item 5</div>
</div>
But on desktop I want it to appear like this:
Note The width of columns are dynamic, and the height of the boxes are also dynamic.
I've tried both CSS Grid and Flexbox, but the problem is the equal columns on both strategies mean there are empty gaps between the items, which I don't want (notice the row gridlines do not line up).
I know this can be achieved with floats but I'm wanting to move away from that and only rely on flexbox/grid.
How might I achieve this?