Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tailwindcss group-hover not working on border color

When I hover over a navigation item, I want a span border color to be changed. The group-hover does nothing...

Is this just not implemented in Tailwindcss yet?

 <a class="group px-4 py-2 hover:bg-white
            hover:text-primary transition-colors duration-300
            rounded-sm"
     :href="route">
    <span class="pb-1 border-b border-white group-hover:border-black">
        <slot/>
    </span>
  </a>

I obviously can do this by writing css like this, but tailwind should be able to do this, right?

a:hover span {
  border-color: black;
}
like image 970
Madriesen Avatar asked Dec 31 '22 22:12

Madriesen


1 Answers

you need to enable group-hover in tailwind config file.

You can control whether group-hover variants are enabled for a utility in the variants section of your tailwind.config.js file:

module.exports = {
    variants: {
textColor: ['responsive', 'hover', 'focus', 'group-hover'],
 },
}
like image 130
Zargham Khan Avatar answered Jan 05 '23 14:01

Zargham Khan