Create Account | Sign In Browse All Bookmarks

CSS Sprites Demo


The following image are displayed using CSS Sprites:

smile fish people potato head

The images above are "pulled" from the following image, which contains the sprites at known locations.

When used in conjunction with a transparent pixel image and CSS, you can greatly reduce page load time, bandwidth, and the tax on your server(s) without sacrificing on search engine visibility. This can be done because we use an actual IMG tag for each sprite. Thus, we point each IMG to a unique and meaningful URL, though each loads the same transparent GIF. And we can give each IMG an ALT and TITLE attribute as we see fit.

The code:

When not to use this technique:

In the rare circumstance that your users need to be able to right-click on your image to save them for view their properties, this technique should not be used. This technique can also cause issues printing the page, as background-images (like sprites) are ignored by default in most browsers for printing purposes.

However, for most purposes, this technique is a great way to conserve on bandwidth and HTTP requests, thus improving both the end-user and administrator's experience!

Oh no! I'm an idiot!

If I've made a mistake somewhere on this page, or if you have any questions, please feel free to use my contact form to let me know.

Help Svidgen!

If you found this little demo helpful, please support the site by creating an account and using our social bookmarking and socially fueled search engine. The more folks that supporting this, the sooner I can get around to implementing the rest of the pending updates.