I'm struggling achieving the layout that you can see in this photo.
Long story short, I'm trying to create a dynamic layout where I will have elements with different heights and dynamic number of columns / rows based on number of elements.
Rules:
- If I have 6 elements -> 3 columns 2 rows.
- If I have 2 elements -> 2 columns 1 row
- If I have 1 element -> 1 column 1 row
I was thinking that I might use display: grid, but then I realized that they won't keep their margins equals if the elements have different heights.
Anybody had same problem?
More examples here.