Can I use <div> tags like Table and have them under each other?

Discussion in 'HTML & Website Design' started by Nima, Dec 18, 2006.

  1. #1
    Hey,

    Can I use <div> tags like tables in the following way:

    <div>

    <div>
    </div>

    </div>

    and expect that the inner <DIV> would be inside the other one?


    Basically I want to put a DIV that holds everything together (with a width of 1000) and have other DIVs (for header, left menu , and such) that are inside that first DIV (So that I can give these new DIVs positions relevant to the main DIV)

    Thanks for the help..

    Nima
     
    Nima, Dec 18, 2006 IP
  2. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Yes, it's called nesting.

    Look at the source of my site. :)
     
    dp-user-1, Dec 18, 2006 IP
  3. parusa619

    parusa619 Banned

    Messages:
    556
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Of course you can, some sites have that div nesting to avoid long page loads using tables. :)
     
    parusa619, Dec 19, 2006 IP
  4. isti

    isti Banned

    Messages:
    322
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    that is how most of the developers do their designs...
     
    isti, Dec 19, 2006 IP
  5. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You might need to use something like
    clear: both
    Code (markup):
    or float the elements as well.
     
    Corey Bryant, Dec 19, 2006 IP
    Nima likes this.
  6. Nima

    Nima Well-Known Member

    Messages:
    3,489
    Likes Received:
    243
    Best Answers:
    0
    Trophy Points:
    175
    #6
    What does that do?
     
    Nima, Dec 19, 2006 IP
  7. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #7
    clear:both will stop the divs from overlapping on bigger screen resolutions. (i think)
     
    just-4-teens, Dec 19, 2006 IP
  8. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #8
    clear: both;
    Code (markup):
    will basically make sure that that element will appear below the last element(s) - check out CSS Clear properties.

    Float will help align the element correctly. This one I find especially useful with images
     
    Corey Bryant, Dec 19, 2006 IP