Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

html elements ordered from top to bottom, but stacked from bottom to top [closed]

$
0
0

Imagine a list of items where a maximum of four can fit across the width of the available space. Where there are six items, I want it to look like this:

[1] [2]

[3] [4] [5] [6]

Where there are 7 items, I want it to look like this:

[1] [2] [3]

[4] [5] [6] [7]

And where there are 9 items, I want it to look like this:

[1]

[2] [3] [4] [5]

[6] [7] [8] [9]

So while the reading order is standard top-to-bottom, left-to-right, priority is given to filling the bottom rows.

Is there a way to achieve this dynamically? That is, with a CSS solution that will adapt to the number of items and won't require me to set individual styles?


Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>