Will the b开发者_开发问答rowser 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. The rendering of the image has nothing to do with the downloading of the image.
Edit:
Try using Chrome or Firefox to perform a timing-test of a page's resources. Notice that all images get downloaded. Even ones whose display style is set to none.
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: none
or is inside an element withdisplay:none
, the browser may opt not to download the image until thedisplay
is set to another value.Only Opera downloads the image when you switch the
display
toblock
. All other browsers download it immediately.
精彩评论