CSS Sprites
I've heard CSS sprites for quite sometime now, but never really tried to understand how to implement it.
But this article explains it to me in a nice, simple way:
http://cssglobe.com/post/3028/creating-easy-and-useful-css-sprites
Basically, you will need to have the following CSS properties:
1. width
2. height
3. background-position
The first two are a no brainer. The last one is a bit tricky. Basically it tells how much to shift the image to the left, and to the top. Hence, the values are always negative.
For example, taking the code from that article:
.sprite {background:url(../images/mySprite.png);}
.monster {height:128px;}
.application {height:61px;}
.wolf {width:115px; background-position:-196px -2px;}
This is saying that the class wolf is 115px wide, and to position the background correctly, move the background 196 px to the left, and 2 px to the top.
Oh and to use the css above, we'll have to combine 'wolf','monster', and 'sprite' classes together.
Very nice article. I highly recommend it.
