Version 4.0.4 - Breaks desktop first support #16340
-
Tailwind: 4.0.4 Describe your issue V3Code Snippet <div class="hidden w-full justify-center md:hidden sm:flex"> Result in DOM V4Code Snippet <div className="hidden w-full justify-center md:hidden sm:flex"> Result in DOM Here is relevant part of the tailwind.config.js. /** @type {import('tailwindcss').Config} */
export default {
darkMode: "selector",
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
screens: {
"2xl": { max: "1536px" },
xl: { max: "1280px" },
lg: { max: "1024px" },
md: { max: "900px" },
sm: { max: "600px" },
}
},
plugins: [],
} This worked fine in v3 and hopefully we are just missing something small and this can be fixed without us having to downgrade back to v3. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
You can convert your variants to use the |
Beta Was this translation helpful? Give feedback.
-
Now by change the variants, I'm assuming you mean something like this <div class="hidden w-full justify-center max-md:hidden max-sm:flex"> I have tried doing this, and tailwind doesn't recognize max-md or max-sm. |
Beta Was this translation helpful? Give feedback.
-
Seems to be working in this Tailwind Play which would suggest something particular to your project is stopping it from working properly. Consider providing a project that reproduces the unexpected behavior if you would like further debugging assisstance. |
Beta Was this translation helpful? Give feedback.
-
@wongjn I was able to get it working now thanks to the tailwind play you supplied. Thank you! The issue came with this part of our tailwind config: screens: {
"2xl": { max: "1536px" },
xl: { max: "1280px" },
lg: { max: "1024px" },
md: { max: "900px" },
sm: { max: "600px" },
} As soon as I changed it to this: screens: {
"2xl": "1536px",
xl: "1280px" ,
lg: "1024px",
md: "900px",
sm: "600px",
} and then ran a script that updated all Should it be added in the documentation/upgrade that support for max within the screens option is no longer supported? Here is the bash script I ran to mass update the directives in case anyone else runs into the same issue I did. find . -type f -exec sed -i 's/sm:/max-sm:/g' {} \; I just replaced |
Beta Was this translation helpful? Give feedback.
@wongjn I was able to get it working now thanks to the tailwind play you supplied. Thank you! The issue came with this part of our tailwind config:
As soon as I changed it to this:
and then ran a script that updated all
*:
tomax-*:
I got it working.Should it be added in the documentation/upgrade that support for max within the screens option is no longer supported?
Here is the bash script I ran to mass update the directives in case anyone else runs into the…