Image preloading with CSS
This is an old one from the CSS Ninja, it is one I seem to use quite a bit.
The CSS content property in conjunction with the <i>:before</i> and <i>:after</i> pseudo-elements allows us to generate content in a document.
Couldn't be much simpler. Just add the following css, with your references to images to preload.
body:after
{
content: url(img01.jpg)
url(img02.jpg)
url(img03.jpg);
display: none;
}
<b>Browser support</b>
IE8+
FF2+
Safari 3+
Chrome 1+
Opera 9.62+
Written by Steven Iseki
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Related Tags
#css
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#