Preload images using CSS


/ Published in: CSS
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments


You need to login to view comments.