Hi there, this is my first post...I'm hoping someone can help me. I recently took up CSS and have been reading a lot, going through tutorials etc...but I'm still having a problem understanding how to style unordered lists as a menu. You can view my test environment here: http://www.jomar.com/test/menu_test.html I'm trying to make the buttons fill with white when hovering...but all I get highlighted is the height of the font. Here's my CSS and HTML <style> #menus { background-color:#CCCCCC; width:200px; padding:5px; } #menus ul{ display:block; list-style:none; text-align:left; margin:0; padding:0; width:100%; } #menus li { border-bottom:1px solid #666666; margin:0 0 10px 0; background-color:tan; padding:10px; } #menus li a { display:block; text-decoration:none; font-family:Arial, Helvetica, sans-serif; } #menus a:hover { background-color:white; } </style> <body> <div id="menus"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Contact Us</a></li> <li><a href="#">Products</a></li> <li><a href="#">Tech Corner</a></li> <li><a href="#">About Us</a></li> <li><a href="#">Documentation</a></li> </ul> </div> </body> </html> I guess what I don't quite understand is the heirarchy of divs and lists and what to place where. I realize the div is the container, but when it comes to assigning classes to lists, I get lost. My #menu div seems to be handling most of the styling of the list without having to call a class. When is it appropriate to assign the list a class?
Do you want a white background on the button when they are hovered over? I am not sure what you are asking because they are already white. Currently when you hover there is a brown background. What are you ideally looking for?
I've been messing around with it trying to get it to work since I posted it...the color doesn't matter. What matters is that the rollover color change fills up the entire box rather than just the height of the font.
Got it! the key was here, in this class: .list li:hover { display:block; background-color:tan; padding:10px; } which was changed from .list li a:hover
cool...but as a follow up question, what if I wanted to make each hover attribute a different color. Would I have multiple .list li:hover { } tags? In other words, would I assign each <li> a class <li class ="home"> <li class ="contact"> <li class ="products"> and then call it from css with: .home li:hover {} .contact li:hover {} .products li:hover{} etc...