CSS Sprites: What is it and How can you reduce Webpage loading time?

CSS sprites allow you to reduce the number of HTTP requests by creating a single file that contains all the images merge out in a grid and let the browser to make a single call to the server. A single call to the server let the browser to in the reduction of number of HTTP, which helps in increasing the web page’s performance.


Why CSS Sprites gaining popularity?

Rather than HTML content images are the major area of concern in increasing or decreasing the web page performance considerably. There are atleast 3-4 images in every web page which are much responsible for taking the much more time to download at the client site.

The real statistics which prove the above fact is done by “The 80/20 rule which tells us about reducing http requests“.

Table : Time Spent in loading Popular Websites

Time Retrieving HTML Time elsewhere
Yahoo! 10% 90%
Google 25% 75%
MySpace 9% 91%
MSN 5% 95%
ebay 5% 95%
Amazon 38% 62%
Youtube 9% 91%
CNN 15% 85%

So, from the above statistics it is clear that Why CSS Sprites gaining popularity and what role it has to play in a web page.

Advantages of CSS Sprites

1. Reduces number of HTTP requests

Whenever a user visits on a website, the browser requests the data from the server. The client(i.e.browser) made an http request to load the page from the server on which it is save. Every image on a webpage made a different http request to the server, so more number of images leads to more HTTP requests to the server which ultimately leads to more downloading time. So, CSS Sprites helps in reducing number of http requests by combining number of images in a single image.

2. Saves downloading time of webpage

Reducing number of images on the webpage helps in saving the downloading time of the web page and ultimately increase the web page’s performance. CSS sprites helps in merging number of images which saves the downloading time.

3. Reduced file size

CSS Sprites containing more number of smaller images will have more savings on file size than the cumulative of individual images. So, combining smaller images in a single images reduced the file size and helps in the web page’s performance effectively.

4. Flexibility

Flexibility in a web page is very important feature, if your webpage has more flexibility the user loves to visit back to your site. CSS Sprites helps in making your web page more flexible.

How to implement it?

FireShot capture #072 - 'CSS Sprites generator' - csssprites_com

CSS Sprites are really simple to implement on your webpage. There are a lot CSS Sprites generators available online from which CSS Sprites Generator is one of them. CSS Sprites Generator is one of the best generator as it has a simple mechanism to generate a code to make your web page more efficient then ever. You can choose as much number of images as you want to make them as a single image so that it would make your web page more attractive and a efficient one. You can also choose the padding between the two elements you choose, border around the whole image, background colour and how to align them. You can see the preview and can generate the code.


About the Author

2 Enlightened Replies

Trackback  •  Comments RSS

  1. Nihar says:

    Thanks for sharing this.

    Will check this out.

  2. Rajendranath Mehrotra says:

    Dear Sir,
    Pl. explain in simple language so that novices like me, can make use of this advice.
    Waiting for Ur reply..
    With due regards,

Post a Reply

Your email address will not be published. Required fields are marked *