Skip to content
Discussion options

You must be logged in to vote

You'd want to put your rule in @layer utilities: https://play.tailwindcss.com/nCY33tCbKN?file=css

Explanation

In v4, CSS rules are placed in native cascade layers. Utility classes are placed in @layer utilities.

With text-gray-950!, this would have the !important flag on the properties. !important flags inside cascade layers will always override non-layered rules, regardless of source order, specificity, etc. Hence, by placing our own rule inside @layer utilities, they are now on equal footing in terms of cascade layer. This means source order and specificity will have an effect. Thus, our custom rule now overrides the text-gray-950! utility class rule.

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by alicerocheman
Comment options

You must be logged in to vote
5 replies
@wongjn
Comment options

wongjn Mar 11, 2026
Collaborator

@alicerocheman
Comment options

@wongjn
Comment options

wongjn Mar 12, 2026
Collaborator

@alicerocheman
Comment options

@wongjn
Comment options

wongjn Mar 12, 2026
Collaborator

Comment options

You must be logged in to vote
1 reply
@emmnull
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #19780 on March 11, 2026 13:06.