I've been utilizing the React Material UI Grid System to arrange my elements on the page, which utilizes flexboxes internally.
While everything is functioning properly, I'm struggling with horizontally aligning items in containers that have varying numbers of items.
In this example, there are 2 container items each with a width of 6. The first container includes items x1
and x2
, while the second container contains y1
, y2
, and y3
. The current arrangement looks somewhat odd; my goal is to have x1
aligned horizontally with y1
, and likewise for x2
and y2
.
The reason for placing x1
, x2
in the first container and y1
, y2
, y3
in the second container is their semantic relationship. This allows me to assign different values for xs
, sm
, md
, lg
, xl
to the outer container so they maintain order after breakpoint adjustments.
If I were to simply place them in 3 rows with 2 columns each, they would appear in the sequence x1
, y1
, x2
, y2
, ... which is not ideal.
Thus, my question is: how can I achieve horizontal alignment?
Edit:
This is the current appearance:
https://i.stack.imgur.com/0ZyYC.png
This is the desired look: