SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast earph's Avatar
    Join Date
    May 2004
    Location
    Austin
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Load Background First?

    I'm loading the background of my site using CSS and when I visit my site, it always seems to load the background last. Is there anyway I can get it to load first?

    Am I missing something?

    Thanks!

  2. #2
    gimme the uuuuuuuuuuu duuudie's Avatar
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    2,253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    I don't think that you can actually tell the browser which part of your pages you want to load first using CSS. Neither can you load one part faster than the others. What you can do is force the browser to load all the images before displaying anything to the user. That way, all the images will appear at the same time.
    Javascript would be a much more appropriate tool to handle this as far as I can see.
    However, it seems that there is a little trick to do what you want. Put that between your head tags:
    Code:
    <script type="text/javascript">
        load_img = new Image();
        load_img.src = 'image file name here';
    </script>

  3. #3
    SitePoint Enthusiast earph's Avatar
    Join Date
    May 2004
    Location
    Austin
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will having that javascript in my page still allow me to meet W3C validation? Also... off the wall question.... but I've heard that javascript can mess with your search engine rankings....

    Is that true? What have you heard?

  4. #4
    gimme the uuuuuuuuuuu duuudie's Avatar
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    2,253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have no idea about search engine rankings... but honestly I doubt it. Most sites use javascript. And they get ranked pretty well. Perform a search for any keyword, check the source code of the three top listed and bet that they use javascript.
    As long as your javascript is correctly declared, the validation shouldn't be a problem.

  5. #5
    gimme the uuuuuuuuuuu duuudie's Avatar
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    2,253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well.. just to make things clear... My advice is that you don't care about the time it takes for your pages to load... as long as it's not too long, that's fine. Avoid yourself the javascript hassle. And if not absolutely needed, bg images should not be used.

  6. #6
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by duuudie
    I don't think that you can actually tell the browser which part of your pages you want to load first using CSS.
    That's not quite right, I think. I remember reading recently about the order that elements in a page are loaded, and one of the points was that most browsers will load CSS background-image images last of all. Unfortunately I can't remember where I read it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •