Mark Weiss wrote:
> Let's say a style sheet for an entire web site has 22 background
> images it references. However on one of the pages in the web site it
> only uses 5 of those background images. So does the site make 22
> http requests to download all of those background images from the
> style sheet or does it only make 5
> http requests and only download the 5 background images actually used
> on the page..
> I'm new to CSS-Discuss, so if I'm doing this wrong I apologize.
Yours is an interesting question, even if I believe the CSS specs say
nothing about this, so browsers are free to do what they prefer.
As far as I know (checked looking at server's logs and/or http traffic) all
the current browsers (and probably also older ones) do not make requests for
not used background images (i.e. mentioned in CSS rules whose selectors do
not match any element on the page.)
The only exception is IE5.2 on Mac (which is not a current browser.)
(Don't take this as a definitive answer, things may depend on circumstances
that I have overlooked.)
Browsers behavior is more different in the case of background images
attached to elements with display:none. In this case some (IE, Safari) seem
to request the image anyway, others (Gecko, Opera) do not.
Bruno Fassino http://www.brunildo.org/test
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/