How to make 2 row have same column number with flex? #2681
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey, You cannot tell flex to split items equally in two parts, unfortunately. You'll only be able to set a container width, and then let the elements wrap to the next line when the space is used. However, you can achieve that result if you decide to let the items from from top to bottom. Kinda feels hacky, but you could set the container height to something that fits 2 images vertically ( Here's a quick hacky little example of it: https://play.tailwindcss.com/mpTZupvlyK If you don't like that, your best bet here would be at the component level (I assume you use React since I see the That said, you could also use the |
Beta Was this translation helpful? Give feedback.
Hey,
You cannot tell flex to split items equally in two parts, unfortunately. You'll only be able to set a container width, and then let the elements wrap to the next line when the space is used.
However, you can achieve that result if you decide to let the items from from top to bottom. Kinda feels hacky, but you could set the container height to something that fits 2 images vertically (
tw-h-32
), and then set the flex direction toflex-col
, let it wrap withflex-wrap
.Here's a quick hacky little example of it: https://play.tailwindcss.com/mpTZupvlyK
If you don't like that, your best bet here would be at the component level (I assume you use React since I see the
classNames
attribute), s…