That's a perfect use of sprites. Those are images are decoration, and are CSS backgrounds.
You could do it in less code though.
Code:
<ul id="topnav">
<li><a href="index.html" id="h">Go to home page<span></span></a></li>
<li><a href="contact.html" id="c">Contact Information<span></span></a></li>
<li><a href="mailto:enquiries@rbcreations.co.uk" id="e">Send us an email<span></span></a></li>
</ul>
Now you can
Code:
#topnav {
clear: left?
float: right;
min-height: 50px;
margin: 10px 180px 0 0;
}
* html #topnav {height: 50px;} /*IE6... bleh*/
#topnav li {
display: inline; /*IE*/
}
#topnav a {
position: relative;
float: right;
width: 120px; /*home*/
height: 35px;
color: #000; /*heck, set a nice font family here as well, and font size...*/
}
#topnav a span {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: url(images/nav_logo_sprite.gif) no-repeat 0 -608px;
}
/*original span setting == home's setting, everyone else overrides*/
/*give non-image users some feedback*/
#topnav a:focus, #topnav a:hover, #topnav a:active {
color: #that blue in the image...;
text-decoration: none?
}
/*if IE bugs you...*/
#topnav a:hover span {
cursor: pointer;
}
a#h:focus span, a#h:hover span {
background-position: 0px -658px;
}
a#c {
width:169px;
}
a#c span {
background-position: -20px -408px;
}
a#c:focus span, a#c:hover span {
background-position: -20px -458px;
}
a#e {
width: 95px;
}
a#e span {
background-position: -20px -508px;
}
a#e:focus span, a#e:hover span {
background-position: -20px -558px;
}
Not tested, just rearranging yours.
What this does is when images are off, there's still text to be viewed. In fact, that text can be styled to imitate what your rollovers are doing. So, I've added more code for text. You want everyone to see some feedback when they hit a link, no matter if they have images or not, no matter if they have a mouse or not...
You've got a mystery meat menu right now, for anyone who, say, is in a busy wi-fi cafe where turning images off is the only reasonable way to get a page loaded before lunch?
or you screw up a path?
or the images load but on a slow connect take forever to load?
http://stommepoes.nl/Forms/noimages.png
Using Gilder-Levin in some form basically prevents this. And it's why I use it. There are lots of ways to do it though, I only listed one way.
Bookmarks