<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB"><title>Comments on Preload Images with CSS - AddedBytes.com</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/" /><link rel="self" type="application/xml" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/atom/" /><subtitle>Latest comments on Preload Images with CSS on AddedBytes.com</subtitle><author><name>Dave Child</name></author><updated>2004-12-23T10:13:43Z</updated><id>tag:addedbytes.com,2004:209</id><!-- ckey="76C662BB" --><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by George ( &lt;a href="http://www.gcalderon.com"&gt;http://www.gcalderon.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;A co-worker of mine suggested using CSS sprites technique (http://alistapart.com/articles/sprites/), since the bg image is loaded when you load the pre-hover state of the element, all you would need to do is specify background positioning for the css hover declaration.</summary><id>tag:addedbytes.com,2008:105103</id><published>2008-10-02T18:56:01+01:00</published><updated>2008-10-02T18:56:01Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by Dameian ( &lt;a href="http://www.dameian.com"&gt;http://www.dameian.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Here is what I do. If this helps anyone, terrific... I'll go buy myself a snickers bar and feel all fuzzy inside. If not... I'll sink into a deep depression and rock back and forth in the darkest corner of my office muttering &quot;Mad Word&quot; by Tears for Fears...&lt;br /&gt;
&lt;br /&gt;
In my CSS:&lt;br /&gt;
&lt;br /&gt;
#preloader {&lt;br /&gt;
position:absolute;&lt;br /&gt;
top:-1000px;&lt;br /&gt;
height:100px;&lt;br /&gt;
width:100px;&lt;br /&gt;
overflow:hidden;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Then at the very top of my page under the body tag:&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;preloader&quot;&gt;&lt;br /&gt;
&lt;img src=&quot;preload-image-1.gif&quot; height=&quot;10&quot; width=&quot;10&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;preload-image-2.gif&quot; height=&quot;10&quot; width=&quot;10&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;preload-image-3.gif&quot; height=&quot;10&quot; width=&quot;10&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;
etc...&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This will not be visible on your pages, and *should* take care of any browsers that do not render images if a &quot;0&quot; size is given to them or if they are &quot;hidden&quot;. &lt;br /&gt;
&lt;br /&gt;
I actually use this to eliminate the delay that browsers seem to have loading CSS background images but I can't see how it wouldn't work for rollover images as well. &lt;br /&gt;
&lt;br /&gt;
I have tested this using FF and Safari on Mac as well as IE6 and IE7 on Windows. I have not tested it in the lesser used browsers because, truth be told, shooting myself in the face right this second with a 12 gauge shot gun would be a more joyous alternative to the self-torture I'd subject myself too if I tried to please the logic/rendering engines of every single browser. In the words of the late, great Bob Marley: &quot;You can't fool all the people all the time...&quot;&lt;br /&gt;
&lt;br /&gt;
Cheers!</summary><id>tag:addedbytes.com,2008:97162</id><published>2008-06-26T13:46:34+01:00</published><updated>2008-06-26T13:46:34Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by itruscan ( &lt;a href="http://www.webchiator.exofire.net/newdoc/"&gt;http://www.webchiator.exofire.net/newdoc/&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;joel watson  #preload { height: 0; overflow: hidden; } &lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;preload&quot;&gt;&lt;img src=&quot;layout1.png&quot; /&gt;&lt;img ... &gt;&lt;/div&gt;  what to put inside &lt;img ...&gt;???</summary><id>tag:addedbytes.com,2008:96698</id><published>2008-06-09T23:58:14+01:00</published><updated>2008-06-09T23:58:14Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by Adaptiv Media ( &lt;a href="http://www.adaptivmedia.com/"&gt;http://www.adaptivmedia.com/&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;This is absolutely brilliant. I have been searching for a non-javascript solution to do this for ages. Cannot thank you enough. ILoveilovejackdaniels.com!</summary><id>tag:addedbytes.com,2008:94633</id><published>2008-05-04T08:36:28+01:00</published><updated>2008-05-04T08:36:28Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by Jad ( &lt;a href="http://www.anahaifa.com"&gt;http://www.anahaifa.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;thanks!! nice one</summary><id>tag:addedbytes.com,2008:92623</id><published>2008-04-18T12:51:58+01:00</published><updated>2008-04-18T12:51:58Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by luispunchy ( &lt;a href="http://www.luispunchy.com"&gt;http://www.luispunchy.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;#34 touched on the issue of IE flicker. In the first technique (the Pixy method: one image with both states, revealed by background position), IE can flicker b/c that browser pings the server for the image again (even though it shouldn't). &lt;br /&gt;&lt;br /&gt;The same fix should work. Apply the same background image, in hover state position, to the element's parent. In that instant while the image flickers on hovering the element, the parent's copy of the image rollover will be there to save the day. This works best with simpler designs, of course.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;#&quot;&gt;hover me&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;/* background image */&lt;br /&gt;a, a:link, a:visited {background:url(image.gif) 0 0 no-repeat;}&lt;br /&gt;a:hover {background-position:0 -50px;} /* image moved up whatever distance needed */&lt;br /&gt;&lt;br /&gt;/* background image in rollover position, applied to parent element */&lt;br /&gt;p {background:url(image.gif) 0 -50px no-repeat;}&lt;br /&gt;&lt;br /&gt;Also, a few earlier comments noted another problem with that fact that IE doesn't apply the :hover pseudo-class to anything else but &lt;a&gt; tags. There is a behavior file out there that fixes this - search for &quot;csshover.htc&quot;, problem solved!</summary><id>tag:addedbytes.com,2008:70060</id><published>2008-01-07T01:38:21+00:00</published><updated>2008-01-07T01:38:21Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by LCTPAdmin ( &lt;a href="http://lowcosttradingpost.com/"&gt;http://lowcosttradingpost.com/&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;This method works most of the time but when you are working with multiple layers or two different images in IE you will sometimes get flicker. If you load a wrapper with the same image (in my case I used a table td around a nested div identically sized) you can fool IE. Basically it is smoke and mirrors. In the gap between the time it takes the image to change you just show a repeat of the first image. &lt;br /&gt;&lt;br /&gt;If you are real sharp I guess you can code in a browser detection so that Firefox doesn't pay for IE's slow transitions. &lt;br /&gt;&lt;br /&gt;Thanks Dave! I have enjoyed your site again and again! Just like my JD!</summary><id>tag:addedbytes.com,2007:52315</id><published>2007-09-11T06:25:47+01:00</published><updated>2007-09-11T06:25:47Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by Carrousel Yacht ( &lt;a href="http://carrouselyacht.com"&gt;http://carrouselyacht.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Thanks for sharing this idea, I was looking for a css preload technique for my image rollover menus. I appreciate the help!</summary><id>tag:addedbytes.com,2007:45989</id><published>2007-07-25T14:59:56+01:00</published><updated>2007-07-25T14:59:56Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by gcyrillus ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;i came up with the same idea for preload in css , there is so many tags with no backgrounds that it is quiet easy to insert. &lt;br /&gt;Very useful for roll overs in menu with hidden text .&lt;br /&gt;img tags can as well hold css preload in their backgrounds :).&lt;br /&gt;&lt;br /&gt;For the display:none; option , i might remenber that netscape will not preload the background , following strictly the rule display:none; it will not care about it at all.  &lt;br /&gt;beside the height:0; overflow:hidden; and z-index:-1 (for opera)  works fine too to hide somethings , but it could become extra tags ... where using empty backgrounds makes it easier :)&lt;br /&gt;&lt;br /&gt;great site !&lt;br /&gt;&lt;br /&gt;GC</summary><id>tag:addedbytes.com,2007:29815</id><published>2007-04-05T00:33:00+01:00</published><updated>2007-04-05T00:33:00Z</updated></entry><entry><title>Comment on Preload Images with CSS</title><link rel="alternate" type="text/html" href="http://www.addedbytes.com/article/preloading-images-with-css/comments/" /><summary type="text">Comment by Shawn ( &lt;a href="http://www.carptool.com"&gt;http://www.carptool.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I came up with the following solution for may site&lt;br /&gt;&lt;br /&gt;.loadbg {&lt;br /&gt;display:none;&lt;br /&gt;height: 0px;&lt;br /&gt;margin: 0px 0px 0px 0px;&lt;br /&gt;padding: 0px 0px 0px 0px;}&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;images/hmleftbg.gif&quot; class=&quot;loadbg&quot;&gt;</summary><id>tag:addedbytes.com,2007:28588</id><published>2007-03-23T17:33:24+00:00</published><updated>2007-03-23T17:33:24Z</updated></entry></feed>