Skip to content

Using space-y-* utilities in reversed flex containers #3619

Answered by simonswiss
fac42 asked this question in Help
Discussion options

You must be logged in to vote

Hey!

When using spacing utilities inside reversed flex containers, you can use the space-{x/y}-reverse utility:

https://tailwindcss.com/docs/space#reversing-children-order

Note - since you want to "un-reverse" them for the lg breakpoint, you'll need to redeclare your spacing for the large breakpoint with lg:space-y-4. This will redefine the --tw-space-y-reverse CSS variable to be 0 instead of 1.

The below set of classes on your <article> tag will do the trick 👍

<article class="space-y-4 flex flex-col-reverse space-y-reverse lg:flex-col lg:space-y-4">

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fac42
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