Skip to content

Important classes not being overridden by later declared important classes #8467

Closed Answered by adamwathan
secondmanveran asked this question in Help
Discussion options

You must be logged in to vote

Hey! If I'm understanding correctly you are saying that in previous versions of Tailwind, the order of the classes in the class attribute impacted the rendered style, like:

<button class="bg-red-500 bg-green-500">I'm green</button>
<button class="bg-green-500 bg-red-500">I'm red</button>

This just isn't possible though, it's not how the browser works. The only thing that matters is the order of the styles in the CSS file, not the order in the class attribute.

Here's an example using no Tailwind at all that demonstrates it:

https://jsfiddle.net/tefxs2da/

You shouldn't ever be adding "conflicting" classes at the same time (like two different background color classes) because the result is n…

Replies: 2 comments 1 reply

Comment options

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

Answer selected by secondmanveran
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
3 participants
Converted from issue

This discussion was converted from issue #8466 on May 29, 2022 00:35.