Replies: 2 comments 4 replies
-
Hey! This is a side-effect of us using native cascade layers in v4. Styles that are not in layers will always take precedence over styles that are, and since your custom styles are not in a layer they always win. The fix is to make sure your custom styles are also in a layer, here's a working demo: https://play.tailwindcss.com/YvhTxiMbhN?file=css Hope that helps 👍 |
Beta Was this translation helpful? Give feedback.
-
Responding to the other issue you raised: #16075 I think Adam already explained the technical aspects of your question pretty well but I want to give one additional idea:
One alternative that does not require you to patch Tailwind utilities and rely on the order is to use CSS variables for text colors that can adapt automatically to dark mode for you. Something like this: https://play.tailwindcss.com/bqNYWq5bbb |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Tailwind CSS are you using?
v4.0.1
What version of Node.js are you using?
v22.1
What browser are you using?
All major browsers
What operating system are you using?
macOS
Reproduction URL
Bug reproduction (v4.0.1): https://play.tailwindcss.com/qtyHMLpV36
Expected (v3.4.17): https://play.tailwindcss.com/0TVYfNUrcC
Describe your issue
Previously in v3.4.17, we were able to force a style in dark mode with
dark:
for a tailwind class that was overloaded in base css file.You can easily see the issue with the reproduction links (Make sure you've dark mode enabled): with the v4.0.1 play link the text appears yellow, but should be blue because of the
dark:text-blue-900
as you can seen on the v3.4.17 play link. But it's displayed in yellow because of the following in css file:Both css and html are similar in the 2 versions.
Beta Was this translation helpful? Give feedback.
All reactions