Will the browser still download the image?
<img src="/myimage.jpg" style="display:none;" />
Will the browser still download the image?
<img src="/myimage.jpg" style="display:none;" />
Yes, at least according to the Net console in Firebug.
As stated by thethimble, CSS is the presentation layer and affects rendering, not the actual processing of the page.
It wouldn't be outside the realm of possibility for some browsers, especially mobile, to potentially not download this in an attempt to optimize performance.
Yes.
However, as a sidenote, some browsers won't download images with width and height attributes of 0. Can't find the source now, and just tested Firefox and Safari and they do download it. Must be IE, can anyone test for me? Thanks.
When in doubt, sniff the line, or use a browser specific tool (Firebug for Firefox, Web Inspector for Webkit, etc)
Quirks Mode: images and display: none
When image has
display: noneor is inside an element withdisplay:none, the browser may opt not to download the image until thedisplayis set to another value.Only Opera downloads the image when you switch the
displaytoblock. All other browsers download it immediately.