Skip to content

How to make 2 row have same column number with flex? #2681

Answered by simonswiss
IRediTOTO asked this question in Help
Discussion options

You must be logged in to vote

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 to flex-col, let it wrap with flex-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…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@IRediTOTO
Comment options

Answer selected by IRediTOTO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants