How do I find the correct offsets for CSS sprites?
6 answers
There are web tools that will create a sprite and provide you with CSS with positions. http://css-sprit.es/ is an example.
+2
source to share
The online CSS Sprite Generator is worth taking a look at, some of the boredom should be taken from this approach.
+2
source to share
The main thing to remember is that the offsets will be negative . If you have an image that is 100x500 with 100x100 sprites then the offsets would be:
.img1 { background-position: 0 0; }
.img2 { background-position: 0 -100px; }
.img3 { background-position: 0 -200px; }
.img4 { background-position: 0 -300px; }
.img5 { background-position: 0 -400px; }
0
source to share