I would like to make a black navigation bar for my site, and when you hover over the first link, it will turn orange, the second green, etc. I know how to change color on hover, but donβt know how to make each link different.
I suppose this has to do with providing identifiers to each li tag?
<div id="navbar"> <ul> <li id="link1"><a href="1.html">1</a></li> <li id="link2"><a href="2.html">2</a></li> <li id="link3"><a href="3.html">3</a></li> </ul> </div>
But how do I create different styles for each of these identifiers in a css file? Below i tried
#navbar ul li a { text-decoration: none; padding-top: 25px; padding-bottom: 25px; padding-left: 30px; padding-right: 30px; color: #ffffff; background-color: #000000; } #navbar ul li #link1 a:hover { color: #ffffff; background-color: #C62222; padding-top:15px; padding-bottom:15px; } #navbar ul li #link2 a:hover { color: #ffffff; background-color: #28C622; padding-top:15px; padding-bottom:15px; }
Help rate!
source share