CSS Sprites
Since this seems such a "hot" topic these days, I figured I might as well spend a couple of minutes and write a quick tutorial on what they are and how to make them work.
The finished result will look like this Arrow
For this mini-tutorial I'll be using an image that looks like this:

When we're not hovering over the link, we want the top image to be displayed. And if we are hovering, show the bottom image. They are both 16px high. Together forming an image of 32 pixels high and 16 pixels wide.
a.sprite { background-image: url('arrow-tut.gif'); background-repeat: no-repeat; background-position: 0 -1px; display: block; width: 16px; height: 16px; padding-left: 16px; margin: 0px; } a.sprite:hover { background-position: 0px -17px; }
That's the actual CSS code I'm using. Display:Block so I can set a defined height (alternatively, use line-height: 16px;)
What the :hover tag does, is shift the background out of position, so the lower 16 pixels of the image are shown, rather than the top 16 pixels.
You can actually integrate the .sprite class to be more general, allowing you to use different kinds of pictures.
All you have to do is leave the background-image: url(); out of the stylesheet and define it inline:
<a class="sprite" style="background-image:url('arrow-tut.gif');" href="http://kalkran.com/">Arrow</a>
You could also use bigger images, with more little pictures on it, and shift it to the correct image for each different state.

April 13th, 2008 at 18:08 #ilias
Interesting, hadn’t heard anything about that yet, although it’s kind of interesting and certainly has a use somewhere.
I assume you’d use this method rather than actually changing the picture in order to make the “changing” of the picture more flawless in cases where you’d be (a) on a low-bandwidth system and (b) using bigger images? Another useful property of this system probably is that you can define the picture inline using only one imagine instead of two..
Also; you forgot to give the <a> tag in the last code-block the sprite class.. fix it! ;)
However, nice tutorial, about something I hadn’t heard of, or at least didn’t know it had a name ;)
April 13th, 2008 at 18:21 #Kalkran
Fixed!
Thanks :>