SpriteMe – Combine images and get fewer HTTP requests
Those of you that care about website performance have probably read about combining images, something that's called "CSS sprites". The idea is that by using the same (somewhat larger) image several times, you get fewer HTTP requests to your site, and therefore speed it up. Problem is, most of your images are CSS background images, that are positioned using clever background-positions and repeats.
Now, this makes to tricky to combine images. Something that repeats horizontally can't be combined with something that repeats vertically (unless there's transparency involved), and wide images can't be combined with narrow ones. So combining is usually tedious, manual work, both to combine the images and then calculate the new background-positions required.
Lucky for us then, that there is a tool called SpriteMe, available as a bookmarklet (a bookmark containing javascript), and as an excellent online demo that walks you through how it works. SpriteMe does all the hard work for you, you just have to copy and paste both the combined images, and the new background rules, to your site.
Decreasing the number of HTTP requests have never been simpler. Well done Steve Souders!
Comments
By: Jim Westergren (#1)
By: Andreas (#2)
instead of .sprite-foo { background: url(sprite.png) ...;} .sprite-bar { background: url(sprite.png) ...;} because only safari is smart enough to request your sprite 1 time in the last case, even if you use expire headers.
By: Cody (#3)
By: Johan (#4)
see exampele
By: Mac (#5)
By: Virtual (#6)
By: Nicolas (#7)
By: Emil Stenström (#8)
By: pkr (#9)
Don’t have a site build process? Then you have bigger problems, or, it could be said, smaller problems, since your current scale probably means you don’t need to worry about boosting performance in this manner.