Struggling to solve a CSS challenge here. I need to arrange an unknown number of items (either spans or divs) in a snake-like pattern within a container.
To clarify, let's say I have 10 items, each 20px wide. I want them to display like this in a 60px wide container:
0 1 2
5 4 3
6 7 8
9
I've experimented with flexbox in CSS, but so far I can only achieve this layout:
0 1 2
3 4 5
6 7 8
9
If it helps, I know the width of individual items but not the container width. Any guidance would be greatly appreciated.
Thanks in advance!