Setting color "a" with "li" on hover

I am using a framework that allows the user to change the parameters of elements using css and I am trying to make "a" change color when hovering over "li" but color "a" does not change, how should I fix it? And I know that I can change the a if I hover over it, but I want it to change by hovering over the l.

<div class="top">

<ul class="menu">
<li><a>Home</a></li>
<li>Products

<ul class="submenu">
<li><a>T-Shirts</a></li>
<li><a>Shirts</a></li>
<li><a>Tank Tops</a></li>
</ul>

</li>


</ul>

</div>

.submenu li{
background-color:#262626;
color:white;
}

.submenu li:hover{
background-color:white;
color:#262626;
}

      

Thanks in advance.

+3


source to share


1 answer


There are several ways.

.submenu li:hover{
    background-color:white;
}
.submenu li:hover a{
    color:#262626;
}

      



or

.submenu li:hover{
    background-color:white;
    color:#262626;
}
.submenu li a{
    color: inherit;
}

      

+5


source







All Articles