Pre-loading background image?

by DavidO
1 replies
  • WEB DESIGN
  • |
I have a background image that's important to the look of my site. Under normal circumstances a background image loads last. I want it to load first so I've coded it as an image element right after the <body> tag, given it absolute position and a negative z-index.

The content has positive z-index so it will go over the image. This seems to work and the image is fast-loading so it doesn't hold things up.

But I wonder if this is an acceptable way to manage this or is there a better, standard way?

Thanks for any suggestions!
#background #image #preloading
  • Profile picture of the author BobJutsu
    Why didn't you just set it as the background for the body element in the css file:

    body {
    background: url(images/yourimage.png);
    }
    {{ DiscussionBoard.errors[1890103].message }}

Trending Topics