CSS Questions

Discussion in 'Web Design and Development' started by Gator24765, Dec 30, 2010.

  1. Gator24765 macrumors 6502a

    Gator24765

    Joined:
    Nov 13, 2009
    Location:
    Texas
    #1
    Over the last few days I have been learning css.. I am going to go with a three column layout with the center column the main area for my content with one outside column ad based and the other one content based. So my question is can I add a div tag inside of a div tag? how can I add 3 rows within my first column in the picture below so that I can have three different areas for content and ads?

    [​IMG]
     
  2. Dunmail macrumors regular

    Joined:
    Mar 27, 2009
    Location:
    Skipton, UK
    #2
    Yes you can have a div within a div, in fact to any level you wish.

    As to the three column layout, there are plenty of examples on the web but if you want equal height columns (which makes things easy if you have different coloured backgrounds for each column) then you need to wrap two of the columns in another div.

    Code:
    <div id="main">
       <div id="wrapper">
           <div id="nav">
           </div>
           <div id="content">
           </div>
       </div>
       <div id="ads">
       </div>
    </div>
    
    Then your CSS would float the wrapper div to the left along with its other attributes, one of which should be a positioning attribute of either relative or absolute so that the inner divs can be positioned relative to its coordinates again using float. The "ads" div is floated right.

    HTH
     

Share This Page