1) using images for menu items screws people who browse with images off. You should be using a image replacement technique like gilder-levin.
2) Those are presentational images, they shouldn't be in the markup in the first place.
3) You are making something simple WAY more complex than necessary... including the pointless DIV around it.
So first order of business is to neuter down the markup to something a bit leaner getting those images out of the markup.
Code:
<ul id="mainMenu">
<li class="home"><a href="/">Home<span></span></li>
<li class="members"><a href="members.html">Members<span></span></li>
</ul>
From there we just
Code:
#mainMenu {
list-style:none;
overflow:hidden;
width:100%;
font:normal 14px/16px arial,helvetica,sans-serif;
}
#mainMenu li {
display:inline;
}
#mainMenu a {
display:-moz-inline-block;
display:-moz-inline-box;
display:inline-block;
position:relative;
overflow:hidden;
padding:8px 0;
text-align:center;
}
#mainMenu .home a {
width:128px;
}
#mainMenu .members a {
width:192px;
}
#mainMenu a:active,
#mainMenu a:focus,
#mainMenu a:hover {
font-weight:bold;
}
#mainMenu a span {
position:absolute;
top:0;
width:1024px;
height:64px;
background:url(images/mainMenu.png) 0 0 no-repeat;
}
#mainMenu .home a span {
left:0;
}
#mainMenu .members a span {
left:-128px;
}
#mainMenu a:active span,
#mainMenu a:focus span,
#mainMenu a:hover span {
top:-32px;
}
Using a single image -- stack your buttons horizontally in the one image, and put the hover states as a second row below the first.
If you post up the images you are trying to use, I can make a working example page for you of this.
Oh, and if you were trying to make the images show up on handhelds that ignore the CSS based images, DON'T!!! It chews up the handhelds memory pretty much ruining the user experience on those devices.
Bookmarks