Skip to content Skip to sidebar Skip to footer

Background Color Change On A:hover

So I basically want to take a navigation i created with div's and make it so that each line (id) will rollover a different color. I've tried a ton of different ways of doing it and

Solution 1:

Never start ID & Class with numerical (1,2,3,) digit. Write like this:

#nav1,#nav2...

HTML

<divclass="navcontainer"><divid="nav1"><ahref="#">home</a></div><divid="nav2"><ahref="#">work</a></div><divid="nav3"><ahref="#">resume</a></div><divid="nav4"><ahref="#">about</a></div><divid="nav5"><ahref="#">links</a></div></div>

Solution 2:

Change your ID names to be alpha not starting with a number..

IE:

.navcontainer #one a:hover {
color:black;
background-color:red;
}

<divclass="navcontainer"><divid="one"><ahref="#">home</a></div><divid="2"><ahref="#">work</a></div><divid="3"><ahref="#">resume</a></div><divid="4"><ahref="#">about</a></div><divid="5"><ahref="#">links</a></div></div>

Post a Comment for "Background Color Change On A:hover"