Replies: 5 comments 2 replies
-
Hey! Any particular issue that you run into with this? |
Beta Was this translation helpful? Give feedback.
-
Here's the potential workaround if someone is facing the same issue, thumbs up if you do.
|
Beta Was this translation helpful? Give feedback.
-
@philipp-spiess any updates or comments on that? |
Beta Was this translation helpful? Give feedback.
-
I have the same issue. This is what i see in my project:
This is what the documentation states: https://tailwindcss.com/docs/max-width
|
Beta Was this translation helpful? Give feedback.
-
First of all thanks @gavar for the workaround - it was a lifesaver! I don't have the solution, but I have one more piece of troubleshooting data. @theme {
--spacing-0: 0;
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 2rem;
--spacing-xl: 4rem;
--spacing-icon: 1.5rem;
} The emitted CSS looked like this: .max-w-2xl {
max-width: var(--container-2xl);
}
.max-w-4xl {
max-width: var(--container-4xl);
}
.max-w-lg {
max-width: var(--spacing-lg);
}
.max-w-md {
max-width: var(--spacing-md);
}
.max-w-xs {
max-width: var(--spacing-xs);
} As you can see the sizes I've specified Perhaps this is expected behavior, but it was very counterintuitive to me, and from what I can see it wasn't mentioned in the upgrade guide. I believe that in Tailwind v3 the "max-width" property seemed to approximate "container sizing" (large elements) while "w-" properties used "spacing sizing" (small elements). This seems to have been changed in v4. While I appreciate the consistency of having widths mean the same thing regardless of contexts I still think this could be worth of a notice in the upgrade guide. As a workaround if you want to preserve the "v3 behavior" you can apply @gavar 's solution, but skip adding the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Tailwind CSS are you using?
v4.1.4
What build tool (or framework if it abstracts the build tool) are you using?
TailwindPlay
What version of Node.js are you using?
N/A
What browser are you using?
Any
What operating system are you using?
Any
Reproduction URL
https://play.tailwindcss.com/cA87EpnMu8
Describe your issue
The
max-w-*
utility classes currently use the--spacing-*
variables for their width values. However, according to the official Tailwind documentation on max-width, these utilities are supposed to use the--container-*
variables.Beta Was this translation helpful? Give feedback.
All reactions