Is there a way to specify which DIV gets loaded first?

Discussion in 'Web Design and Development' started by macaddict23, Jul 14, 2008.

  1. macaddict23 macrumors 6502

    macaddict23

    Joined:
    Jun 20, 2006
    Location:
    MacVille, USA
    #1
    So, I have three divs on my page, left-column, center-column, right-column. My code is below, but I want the right-column to load before the center-column. Thanks in advance!

    Code:
    <body>
    <div id="leftcolumn>Some content . . .</div>
    <div id="centercolumn>Some content . . .</div>
    <div id="righcolumn>Some content . . .</div>
    </body>
    
     
  2. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #2
    Have you tried to obvious? Place the right column DIV before the others?
     
  3. InLikeALion macrumors 6502a

    Joined:
    Jul 18, 2007
    Location:
    Greener places than I used to live
    #3
    As ChrisA said, html and css cascade down. They load from the first to the last, unless somehow affected by something else, like a onLoad rule with javascript. Also, though things start loading with the beginning code to the end, the rendering timing is effected by content file size.

    For instance, if you have a 2mb background image on your <body> tag, it will probably display after your footer's 5kb image loads (assuming whatever main content also loads pretty quickly, such as plain text).
     
  4. macaddict23 thread starter macrumors 6502

    macaddict23

    Joined:
    Jun 20, 2006
    Location:
    MacVille, USA
    #4
    Chris, that is pretty obvious. But my client wants two narrow columns to be on the left and right.
     
  5. InLikeALion macrumors 6502a

    Joined:
    Jul 18, 2007
    Location:
    Greener places than I used to live
    #5
    Would you mind giving us a link? Or could you maybe explain more your reasoning and the scenario of what is happening. You can do some tricky absolute positioning, etc... but even that might not help, depending on the file size of the content to be loaded in the various sections. A link would help us analyze why this is happening and the proper work arounds.

    It would also help me to know why it's so important to load in that order.
     
  6. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #6
    How does that change the idea of placing the right column HTML before the center? You can put the code in any order you want.
     
  7. macaddict23 thread starter macrumors 6502

    macaddict23

    Joined:
    Jun 20, 2006
    Location:
    MacVille, USA
    #7
    Below is an overview of my page. A few paragraphs on the left and right columns, and a constantly growing list down the center column. The right column doesn't load until the center column is finished loading, which I'm hoping to fix.

    Code:
    <body>
    <div id="leftcolumn>Some content . . .</div>
    <div id="centercolumn>Some content . . .</div>
    <div id="rightcolumn>Some content . . .</div>
    </body>
    
    [​IMG]



    But if I switch the order around as some have suggested, this is what I get:

    <body>
    <div id="leftcolumn>Some content . . .</div>
    <div id="rightcolumn>Some content . . .</div>
    <div id="centercolumn>Some content . . .</div>
    </body>

    [​IMG]
     
  8. Me1000 macrumors 68000

    Me1000

    Joined:
    Jul 15, 2006

Share This Page