Currently, I am facing challenges with the layout of this CSS design. The number of items ("n
") is dynamic and can increase indefinitely. My goal is to create a layout that consists of n
rows and many columns (or an unlimited number of columns).
For instance, if n
equals 2, and there are 3 items, the desired arrangement should be as follows:
-----------
| 1 || 3 |
-----------
| 2 |
-----------
With the same value of n
, but having 6 items, the layout should look like this:
-----------------
| 1 || 3 || 5 |
-----------------
| 2 || 4 || 6 |
-----------------
This pattern continues for additional items.
I initially attempted using float: left
, without success. Currently, I am exploring flex layout options, but I seem to have hit a roadblock.
Your guidance would be greatly appreciated! Feel free to check out my Fiddle.
Note: All items will share the same dimensions in terms of width and height.