For Some Odd Reason max-w-lg
(Only!) Reverts to Tailwind Default
#13985
Replies: 3 comments 1 reply
-
Hey! What you're seeing here is that the Here's the source code: https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/config.full.js#L653-L673 Because So what you actually want to do is configure the https://play.tailwindcss.com/6CREypC2BK?file=config Note that by default there is no If your actual goal is for all size related utilities to depend solely on the https://play.tailwindcss.com/TCp5l4P0ws?file=config This completely overrides the |
Beta Was this translation helpful? Give feedback.
-
That's incredibly confusing. I'm sure you have a reason for it all, but ... why? But regardless, shouldn't the above be documented? https://tailwindcss.com/docs/max-width makes no mention of max-width styles trumping the spacing ones; to the contrary, editing spacing is the first thing they recommend (emphasis added):
They do mention that you can set max-width separately, but essentially the sentence I quoted is a lie: if you add it to Why not just tell people to use max-width there and not mention spacing (the simple solution), or explain why you need to use both (if you do)? |
Beta Was this translation helpful? Give feedback.
-
I most certainly did not! I apologize if you misunderstood what I wrote, but it only said the docs are lying. What I wrote was:
... after quoting the docs. And that was in no way controversial: we both agree the docs are "lying" (ie. are incorrect) on that point. I very much appreciate everyone on the Tailwind team (including, but not limited to, you), and I would never accuse you of lying or anything else, especially when it was clear you were only helping! |
Beta Was this translation helpful? Give feedback.
-
What version of Tailwind CSS are you using?
3.4.3
What build tool (or framework if it abstracts the build tool) are you using?
postcss: 8.4.38
vite: 5.0.3
What version of Node.js are you using?
v21.2.0
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction URL
https://play.tailwindcss.com/j1hGAbY7f1
Just inspect the div it generates and you will see:
Also, a quick side note: if you're going to require that people provide repro, why not link to the reproduction tool you want them to use? https://play.tailwindcss.com/ seems like it's expressly designed for this purpose, so why not add a link to it in this template (in the text that says that a repro is required)?
Describe your issue
I have Tailwind on a production site, and it's awesome. Everything works perfectly, as expected ... or at least it did until I saw this today:
What you want to focus on is that the element in question has two classes:
min-w-lg max-w-lg
. And I've defined my own customlg
of20px
in tailwind.config.js:min-w-lg
works exactly as expected, rendering a style ofmin-width: 20px;
. Butmax-w-lg
... despite using literally the samelg
... is instead rendering the default Tailwind style ofmax-width: 32rem;
.I'm far from a Tailwind expert, but if
foo-lg
gives me20px
,bar-lg
should also give me20px
, regardless of what foo and bar are (well, as long as they are spacing properties). As I understand it it, it should be impossible formin-w-lg
to result in a different number of pixels vs.max-w-lg
... but it does.Beta Was this translation helpful? Give feedback.
All reactions