1

I have this rails reactjs app that if I put this line in the form

<input type='submit'/>

It will create for me a blue button. I have just installed Tailwind and if I input this line with tailwind class, it does not have any effect on the button design.

<input type='submit'
              className='bg-red-500  text-white font-bold py-2 px-4 rounded-full'/>

Is there a way that I can override this global settings like putting !important inline in the className?

Any help would be greatly appreciated.

2 Answers 2

6

You can add a ! character before the class name and that should do the job

Example:

<input type='submit'
             className='!bg-red-500  text-white font-bold py-2 px-4 rounded-full'/>

Docs: https://v2.tailwindcss.com/docs/just-in-time-mode#built-in-important-modifier

Sign up to request clarification or add additional context in comments.

Comments

3

Yes, You can config tailwind.config.js if you add this

module.exports = {
  important: true,
}

this will generate all tailwind classes as !important

read more here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.