I used text-[20px]
in <Badge/>
, but it’s overridden by another css class, how can I override tailwind
the class
<Badge
label="1"
className='w-[30px] h-[30px] p-6 ml-4 text-[20px]'
style={{ lineHeight: '20px'}}>
1
</Badge>
I used text-[20px]
in <Badge/>
, but it’s overridden by another css class, how can I override tailwind
the class
<Badge
label="1"
className='w-[30px] h-[30px] p-6 ml-4 text-[20px]'
style={{ lineHeight: '20px'}}>
1
</Badge>
2
Answers
If you want to override the
text-[20px]
on other classes, you can write the class like this:Another thing I found handy when dealing with situations like this is that using your own custom class could increase the specificity and override Tailwind’s base styles.
In your case, you can define a class in your stylesheet like:
Then your template can go as:
This has worked for me in many cases.