Recently, I implemented this code to style the navigation bar on my website. However, I encountered an issue where the color does not change when hovering over the links.
.nav {
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
}
.nav li {
float: left;
}
.nav li a:hover,.nav li a:active {
background-color:#7A991A;
}
.nav li a:link,.nav li a:visited {
display:block;
width:9em;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase;
}
Here is the HTML code:
<ul class = "nav">
<li><a href="index.html">Home</a></li>
<li><a href="products.html">Our Products</a></li>
<li><a href="aboutus.html">Contact us</a></li>
</ul>
I am seeking advice from fellow developers on what mistake might have been made in the code. Any suggestions would be greatly appreciated!