How to change anchor color when you hover over a list
I have a following HTML and CSS.
When I hover over a list, I want to change the background color and font color. However my style does not change when I hover over padding of list, on the border or near a border inside the list.
http://jsfiddle.net/Hbf9D/1/
How can I do it?
#nav li{
display: inline;
text-align: center;
list-style-type:none;
background-color:#1A365B;
margin: 0 6px 0 0;
padding: 2px 11px 4px 11px;
-webkit-border-radius: 8px;
-m开发者_开发知识库oz-border-radius: 8px;
border-radius: 8px;
}
#nav li:hover{
background-color:#E0F1EA;
border: 2px solid #000;
color: #000000;
padding: 0 9px 2px 9px;
}
#nav li a:hover{
color: #000000;
}
#nav li a{
text-decoration: none;
color: #ffffff;
font-weight:bold;
font-family: 'CantarellBold', Arial, sans-serif;
text-transform: capitalize;
font-size: 12px;
}
<ul id="nav" class="grid_16">
<li><a href="#">FORSIDE</a></li>
<li><a href="#">MOBIL</a></li>
<li><a href="#">PC OG SERVERE</a></li>
<li><a href="#">TJENESTER</a></li>
</ul>
try following:
#nav li:hover a{
color: #000000;
}
http://jsfiddle.net/zainshaikh/Hbf9D/3/
it could seem strange, but try to place #nav li a:hover style before #nav li a
精彩评论