I’m trying to change the text color on hover of the parent div using Tailwind’s group-hover feature, but it is not working.
Below is my code, which I am using with React:
<div class="group">
<div>
<div class="group-hover:text-blue">Hover me</div>
<div class="group-hover:text-red">Hover me</div>
</div>
</div>
I have also tried setting the variants
property in tailwind.config.js
as follows, but I still cannot get the group-hover feature to work:
module.exports = {
// ...
variants: {
textColor: ['group-hover', 'hover'],
}
// ...
}
textColor: ['responsive', 'dark', 'group-hover', 'focus-within',
'hover', 'focus'],
textColor: ['group-hover'],
Can someone please help me understand why the group-hover feature is not working?