Max-h-* is not working
I am using tailwind in my project where I have noticed no single problem at all. But when I try to set maxHeight with the default values from Tailwind, no css is applied. For example if I give max-h-80 to any element it is not working but if I set a value for this class in tailwind.config.js file then I get the styles. Seems like there is a bug with the corresponding issue.
Hey! I can't reproduce this, as you can see here it is working as expected:
https://play.tailwindcss.com/GXM6e3GptJ
Closing since no reproduction was provided, please follow the issue template if you would like more help.
I have these problem
Just a note here for people that this is happening to - this seems to happen if you don't have a postcss.config.js file in your root (alongside tailwind.config.js). I got caught out by this when upgrading to the new tailwind as I only had tailwind.config.js.
Running npx tailwindcss init -p in your root will generate a new, empty one. When this was added I found all the styles were working properly.
For anyone else running into this, it can happen if you put your custom maxHeight values in tailwind.config.js under theme.maxHeight instead of theme.extend.maxHeight. Setting theme.maxHeight means that Tailwind will only pull in the maxHeight custom values you specify.
Docs: https://tailwindcss.com/docs/max-height#customizing-your-theme
I've had this for some time, I thought it was intended behavior.
I have postcss.config.cjs and I don't extend maxHeight so both solutions don't work for me
I've just had the same issue. Spent about 1 hour scratching my head why everything else would work but max-h-*.
I re-ran npm run dev and it started working again. Odd. Only seemed to affect max-h-*. Any other class (even if I've never used it before) seemed to be fine.
I bumped into this. Problem was me, not tailwind. Make sure you're doing
class="max-h-[390px]"
as opposed to
class=max-h-[${maxHeight}]
The latter will fail silently, since tailwind needs a statically readable value at build-time, from the source file.
Or, to cut down on the repetition, this will work too
const MAX_SVG_HEIGHT = 390;
const maxHeightStyle = "max-h-[390px]";
and then interpolate maxHeightStyle however you need. The point is, the fully-formed style rule has to be readable from source, anywhere.
I just encountered this issue with "max-h-*", rerunning npm dev seems to fix it, but this is an odd one 😁
I had this problem with max-w-* classes, they just weren't being built into the styles (weirdly, the -md/-lg type classes worked, as did arbitrary -[100px] values, but not the -16, -24 etc.) Restarting run dev didn't fix it, but updating tailwind/postcss and rerunning the server did.
I think you can edit the tailwind.config.js file
For example