I am trying to do button navigation. When one button is pressed, this anchor tag changes the background color to indicate that it is active. I use the background property with gradients, but when I apply the active class to the link, the background does not change color. I tried looking in the Chrome Console and it just shows that the new background color is loaded, but it doesnβt apply. (It has a line through it, as if it were rewritten by another CSS rule. But new CSS colors appear after the old colors, so in order of hierarchy, it should take precedence. Any ideas on what I'm doing wrong
Here is my CSS code:
.main-nav li a {
font-size: .9em;
text-decoration: none;
font-weight: bold;
text-transform: uppercase;
color: #444135;
display: inline-block;
margin: 24px 12px;
background: #AFE4B3;
background: -moz-linear-gradient(#C8F1CA, #D3F1D5 , #AFE4B3);
background: -webkit-gradient(#C8F1CA, #D3F1D5 , #AFE4B3);
background: -webkit-linear-gradient(#C8F1CA, #D3F1D5 , #AFE4B3);
background: -o-linear-gradient(#C8F1CA, #D3F1D5 , #AFE4B3);
background: -ms-linear-gradient(#C8F1CA, #D3F1D5 , #AFE4B3);
background: linear-gradient(#C8F1CA, #D3F1D5 , #AFE4B3);
border-radius: 10px;
padding: 7px;
width: 100px;
}
.active {
background: -moz-linear-gradient(#FF6440, #FF8E73 , #FF6440);
background: -webkit-gradient(#FF6440, #FF8E73 , #FF6440);
background: -webkit-linear-gradient(#FF6440, #FF8E73 , #FF6440);
background: -o-linear-gradient(#FF6440, #FF8E73 , #FF6440);
background: -ms-linear-gradient(#FF6440, #FF8E73 , #FF6440);
background: linear-gradient(#FF6440, #FF8E73 , #FF6440);
}
And here is the HTML to which it applies:
<nav class="main-nav">
<ul>
<li><a class="active" href="index.php">Home</a></li>
<li><a href="library.php">Library</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</nav>
Here is the problem scenario: http://jsfiddle.net/6udt8/
Thanks in advance!