When a user downloads a style sheet, do all background images specified in that style sheet get downloaded as well? Or, are background images only downloaded as needed based on the CSS rules that apply to the current page?
Asked
Active
Viewed 112 times
1
-
I'm guessing a sensible browser would only download the images it needs, but you could verify this with a tool like Fiddler. – twsaef Sep 26 '11 at 00:52
-
If you're on chrome, verify with this extension https://chrome.google.com/webstore/detail/ognampngfcbddbfemdapefohjiobgbdl?hc=ext-pr&hcp=pr1-2 – Mob Sep 26 '11 at 01:04
2 Answers
2
They only get downloaded as they are needed. To verify, use Chrome Debugger tools network tab and watch what gets requested.

bkaid
- 51,465
- 22
- 112
- 128
-
+1 - Great suggestion to point out Chrome developer tools. Firefox will display them as well, but I prefer Chrome. – duffymo Sep 26 '11 at 00:50
-
In some cases, when using media queries, [images are downloaded even if they are not ultimately displayed in the DOM](http://www.cloudfour.com/css-media-query-for-mobile-is-fools-gold/). – steveax Sep 26 '11 at 00:53