2

On mobile here, I have a dropdown menu that comes down with some options in it. I would like these links to change color to grey when one "hovers" on it with the thumb on the phone. I haven't managed though I have tried several options as you can see in the code. This is it:

<div class="total">
  <ul class="nav navbar-nav" >
    <li>
      <div class="id"><a style="width:100px" data-toggle="dropdown" href="#"><img src="grey.png" alt="Friends in class" class="barimage"> <span ></span></a>
        <ul class="dropdown-menu">
         <div class="dropdown">
          <li><p><b><a href="#" class="menunav">Search your friends</a></b>    </p>
          </li>
          <li><p class="menupar"><b><a href="#" class="menunav">My Friends </a></b></p>
          </li>
          <li><p class="menupar"><b><a href="#" class="menunav">My account</a></b></p>
          </li>
          <li><p class="menupar"><b><a href="#" class="menunav">Logout</a></b></p>
          </li>
         </div> 
        </ul>
      </div>
    </li>

and this is the CSS:

.dropdown {
margin-top:-3px;
width: 200px;
height:220px;
background-color: rgba(36, 96, 70, 1);
font-size:20px;
line-height:50px;

border-radius: 3px;

}
.menunav {
width: 200px;
height:80px;
color:green;
font-size:20px;
line-height:50px;
border:solid black;
border-radius:1px; 
} 

a:link {color:white;}
a:visited {color:white}
a:hover.menunav {background-color:grey;}
a:active.menunav {background-color:grey;}
a:focus.menunav {background-color:grey;} 
a.menunav {
display: block;
height: 100%;
width: 100%;
text-decoration: none;
}
Fidelio
  • 174
  • 12

1 Answers1

0

Not really sure why you'd want a hover effect on a mobile device, but using :focus whenever you use :hover should do the trick.

NoobEditor
  • 15,563
  • 19
  • 81
  • 112