Skip to content
Advertisement

Tailwind default color classes not working

I’m building a React application using Tailwind CSS Framework. I have used NPM to install tailwind in my react app in the following manner:

JavaScript

Then I have also edited my tailwind.config.js file in the following manner:

JavaScript

And updated my index.css file in the following manner:

JavaScript

Then I tried to use default color classes that tailwind CSS provides in the following manner:

JavaScript

Or

JavaScript

But using this class is not changing the color of the text or the background of the div. Please, tell me how to solve this problem? Thanks in advance.

For your kind information, I can use custom color classes by writing them in the tailwind.config.js in the following manner:

JavaScript

Advertisement

Answer

Tailwind’s default classes are not working because the custom ones you set in themes is overwriting them. To add custom classes move them into the extend object.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement