By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,359 Members | 1,481 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,359 IT Pros & Developers. It's quick & easy.

loading IMGs vs background-images, speed of

P: n/a
Hi group. I had been setting background-images for some page
elements, which seemed to load absolutely last, and I was
wondering if the pics would appear earlier/faster if I used
IMG tags instead.

If I do stick with background-images, do you think it
matters where the rules are -- in an external stylesheet or
inline rules, e.g.?
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Manatee <ma*****@thesea.au> wrote:
Hi group. I had been setting background-images for some page
elements, which seemed to load absolutely last, and I was
wondering if the pics would appear earlier/faster if I used
IMG tags instead.
Maybe. A browser can request a foreground image as soon as it
encounters the <img> in the code. But it can only request a background
image once it's (a) downloaded the CSS file and (b) parsed the HTML
document to see if the particular style rule in question is used.

Of course if the image is content then it should be an <img>
regardless.
If I do stick with background-images, do you think it
matters where the rules are -- in an external stylesheet or
inline rules, e.g.?


If your CSS file is very large or otherwise slow to download then it
might help. But the browser still needs to download and parse the HTML
before it can request the background.

Steve

Jul 21 '05 #2

P: n/a

Manatee <ma*****@thesea.au> wrote:
Hi group. I had been setting background-images for some page
elements, which seemed to load absolutely last, and I was
wondering if the pics would appear earlier/faster if I used
IMG tags instead.
Steve Pugh <st***@pugh.net> wrote: Maybe. A browser can request a foreground image as soon as it
encounters the <img> in the code. But it can only request a background
image once it's (a) downloaded the CSS file and (b) parsed the HTML
document to see if the particular style rule in question is used.[...]


Thanks Steve. The images are more decorative than content,
but I think I may have to switch to IMG tags to eliminate
some of the delay (for the record, it seems a little faster
so far :) ). M
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.