-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[v4] Wrong specificity of media query with a custom breakpoint value #2099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It happened to me too: my custom breakpoints work in |
mr-wildcard
referenced
this issue
in mr-wildcard/team-ux.com
Feb 19, 2025
Hey! thanks for the feedback and glad you found out how the sorting works but yeah it only compares breakpoint values within the same units. I think you're right we should mention that in the docs, so I'm keeping this issue open so we don't forget. |
This was referenced Feb 21, 2025
Closed
adamwathan
added a commit
that referenced
this issue
Feb 21, 2025
This has been causing repeated confusion already so let's add a section to clarify this. Closes #2099 --------- Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Tailwind CSS are you using?
v4.0.7
What build tool (or framework if it abstracts the build tool) are you using?
@tailwindcss/cli
v4.0.7What version of Node.js are you using?
v22.14.0
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction URL
Describe your issue
If we customize the value of a breakpoint using
px
unit:the generated media query for that specific breakpoint end up before the other media queries using

rem
:This is problematic in case we provide a value that is wider than the other breakpoints using

rem
: in that case we expect the2xl
variant styles to be applied last but they've in fact less specificity than the other media queries:I believe that the unit of the value is also sorted because if I use the
vh
unit, the generated media query is placed at the end, but if I usech
unit, it's placed before.Not sure if that's really an issue and how it could be fixed, but I think that we can quickly fall into this kind of trap and lose hours debugging.
Maybe add a warning in the documentation?
The text was updated successfully, but these errors were encountered: