[v4] Problem with custom spacing - v4 is referencing var(--container-*) instead of var(--spacing-*) #15145
Replies: 2 comments 2 replies
-
So As per #15146, seems like the migration tool should account for this difference. |
Beta Was this translation helpful? Give feedback.
-
Hi there, sorry for jumping in after some time, but I stumbled on a problem: I started using tailwindcss a few months ago, and I started directly in v4. Today I was messing around my global.css and I was trying to improve consistency with margins and paddings and so I did the same as above. But then the page broke because the sections (which have The question is: isn't this confusing? And also i find it quite non-logical, it's probably because of my lack of experience (and I would love some suggestions on how to handle this), but when I think about "spacing" in the context of margins and paddings, I don't consider them in the same way as "element width or size", a small padding on the left of a text is not the same as a small button (I know it's not the best example, but I hope you can get the idea behind). And btw the website is stating something different from the actual behavior (https://tailwindcss.com/docs/theme#theme-variable-namespaces). Thanks in advance for the help and for the amazing product that tailwindcss is. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In my Tailwind v3 project I have the following custom named spacing:
I'm then able to use
class="w-lg h-lg"
in my project. In version 3,w-lg
andw-hg
are correctly being set towidth: 2rem
, andheight; 2rem
, respectively.When I upgraded to v4, the above configuration got converted to:
Now my
h-lg
continues to work as expected. However, myw-lg
is using thecontainer-lg
value. The generated CSS looks like:Notice that
h-lg
references the CSS variable--spacing-lg
, butw-12
references the CSS variable--container-lg
This causes content width to be incorrect after the upgrade. Wondering if this is a known issue?
For the following HTML:
V3
V4
Beta Was this translation helpful? Give feedback.
All reactions