Replies: 4 comments 4 replies
-
The fix should be: .space-y-[value] {
--tw-space-y-reverse: 0;
& > :not(:first-child) {
margin-block-start: calc(calc(var(--spacing) * <number>) * var(--tw-space-y-reverse));
}
& > :not(:last-child) {
margin-block-end: calc(calc(var(--spacing) * <number>) * calc(1 - var(--tw-space-y-reverse)));
};
}
|
Beta Was this translation helpful? Give feedback.
-
The You are likely missing any of these utilities, see: https://play.tailwindcss.com/zlJRdEYOJV More info: https://tailwindcss.com/docs/margin#reversing-children-order |
Beta Was this translation helpful? Give feedback.
-
That sounds like your design decision, but same as what you guys have said, if it is in flex or grid, people should use gap. I treat space is to be used in block parent not flex or grid parent. With change to use |
Beta Was this translation helpful? Give feedback.
-
You are supporting a scenario that shouldn't be used. Where ignore a case that gain great benefit from. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Tailwind CSS are you using?
For example: v4.1.7
What build tool (or framework if it abstracts the build tool) are you using?
Angular CLI v20 - should be vite v7.0.6
What version of Node.js are you using?
v22
What browser are you using?
Firefox
What operating system are you using?
Windows
Reproduction URL
https://tailwindcss.com/docs/upgrade-guide#space-between-selector
Describe your issue
In Tailwind CSS v4, it improved performance of
space-x-*
andspace-y-*
by utilize on:not(:last-child)
instead of* + *
CSS condition. Where it introduce new bug if it is used withspace-x-reverse
orspace-y-reverse
. In reverse order, it should be:not(:first-child)
. Else the last element will missing margin top, where first will have margin top that it should not have.Beta Was this translation helpful? Give feedback.
All reactions