Jump to content

Hover Over Menu Not Working


Kevin M

Recommended Posts

I'm working on a layout, and it uses the <ul> tag for the navigation bar. When someone hovers over a link, the background image should change. The only problem is, not the whole image shows up, just enough to cover the text. I want the whole background image to change to an image that's 90 pixels in width, and 30 pixels in height. Here's the page:LayoutIf you hover over the menu, in IE it does what I explained above. Not sure how it is in Fire Fox. The background image for the hover is this image:hover.gifAnd the Style Sheet section for the navigation bar:

/*Navigation*/#nav {width: 550px;height: 30px;position: absolute;z-index: 3;left: 126px;top: 180px;background-color: #1c3754;margin: 0px;padding: 0px;}#nav ul,li {display: inline;list-style-type: none;height: 30px;font-family: tahoma, georgia, veranda, arial;font-size: 12px;color: #FFFFFF;}#nav li {width: 90px;height: 30px;text-align: center;font-weight: bold;padding-right: 10px;padding-left: 10px;vertical-align: middle;}#nav li a:link {font-size: 12px;color: #FFFFFF;background-image: url(/images/link.gif);font-weight: bold;width: 90px;height: 30px;}#nav li a:hover {font-size: 12px;color: #FFFFFF;background-image: url(/images/hover.gif);font-weight: bold;width: 90px;height: 30px;}

So any suggestions on how I could get it so that the whole background changes when the link is hovered over? Or something that I did wrong in the coding?Thanks,Kevin

Link to comment
Share on other sites

Try adding float: left;#nav li {text-align: center;float:left;}#nav li a {background-image: url(/images/link.gif);width: 90px;height: 30px;float: left;font-size: 12px;color: #FFFFFF;font-weight: bold;line-height:12px; /* Optional: To get position vertically */}For more help: http://www.webcredible.co.uk/user-friendly...tion-menu.shtml

Link to comment
Share on other sites

Thanks for the help, I got the hover over part working. The menu won't vertically align though, I've tried vertical-align and line-height. Any ideas on another solution, or maybe I'm just doing it wrong?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...