Change background of A when hovering on LI

1

I have the following code:

<li class="menu-item">
<a href="http://stanlee.com.br">
<span class="jaw-menu-href-title">Home</span>
</a>
</li>

When I hover over li I want the background to change to white.

I just remember this:

  

.menu-item: hover {background: white}

    
asked by anonymous 13.02.2017 / 16:29

2 answers

3

Do this:

.menu-item:hover a span{background:white;}

.menu-item:hover a span{background:black;}
<li class="menu-item">
<a href="http://stanlee.com.br">
<span class="jaw-menu-href-title">Home</span>
</a>
</li>
    
13.02.2017 / 16:31
2

ul{}
ul li{}
ul li:hover a{background-color:#ccc;}
ul li a{}
<ul>
<li>
  <a>teste</a>
</li>
</ul>
    
13.02.2017 / 17:56