Posted By

SunilTee on 08/11/09


Tagged

css html preload images websites


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

rickfu
aleksanderek


Preload images using CSS


 / Published in: CSS
 

This is a really useful techniques for preloading images on your website. Just place this code after the body tag in the CSS file. Everytime you refer to this image in your CSS file the image will be loaded from cache.

  1. #preloadImages {
  2. width: 0px;
  3. height: 0px;
  4. display: inline;
  5. background-image: url(path/to/image1.jpg);
  6. background-image: url(path/to/image2.jpg);
  7. background-image: url(path/to/image3.jpg);
  8. background-image: url(path/to/image4.jpg);
  9. }

Report this snippet  

You need to login to post a comment.