The Computer Gal Logo - Laptop with coffee and plants
Using Float to Create 3 Columns
The Computer Gal on Facebook
Ask to receive tips and handouts to your email.
    1. Create a new web page in Dreamweaver.
    2. Save the file: Exercises/3ColumnFloat.html
    3. Title tag: Creating a three column layout with a float in CSS.
    4. Highlight and copy the text from this exercise.
    5. Paste the text into your open file using Edit-> Paste Special -> Text Only to keep out the HTML formatting. The numbering and line breaks will be missing.
    6. Create a new Basic CSS file.
    7. Save the file in the same folder as the 3ColumnFloat.html file as 3ColumnFloat.css.
    8. Attach the CSS file to the 3ColumnFloat.html file.
    9. Add two line breaks between items 5 & 6.
    10. Copy an image from your computer to the same folder holding the html and css file you just created.
    11. Insert the image at the line break.
    12. Set this code into your CSS file
      #Photo
      {
          float: left;
          margin: 10px 10px 10px 0;
      }
    13. Add a <div></div> around the photo code. Dreamweaver may have put a <div></div> there already. Or, you may have a <p>.</p> If it's a <p></p>, just change them to div. Notice that the change doesn't make much difference!
    14. Add id="Photo" to the <div>. Notice that the text now wraps around the photo. Notice the margin around the photo has more control than with the "hspace" or "vspace" properties.
    15. Add this code before your #Photo in the CSS file:
      #Container
      {
      }

      #ContentArea
      {
          width: 450px;
          position: absolute;
          top: 0px;
          left: 150px;
      }
    16. Wrap a container <div> around all the content of your new page. The only change you should see is the dotted line from the Container <div>
    17. Wrap a ContentArea <div> around the content inside the Container. Notice that the width of the layer and the positioning apply. The contents aren't centered on the page, because the Container layer isn't centered.
    18. Copy the text from this file into your 3ColumnFloat.html file between the last two </div> tags. This will put the text inside the Container, but outside the ContentArea. However, notice where it sits on the page! Why is that?
    19. Add this code to your CSS file before #Photo.
      #LeftPanel
      {
           width: 150px;
           position: absolute;
           top: 0px;
           left: 0px;
      }
    20. Wrap a LeftPanel <div> around the new content. Now you have two columns. They probably aren't formatted very nicely, but that's something you can do later.
    21. Copy the text from this file into your 3ColumnFloat.html file between the last two </div> tags. This will put the text inside your Container, but outside the other layers. However, notice where it sits on the page. Look familiar?
    22. Add this code to your CSS file before #Photo. Why is left set at 600? Now you have three columns, but the spacing will need some work!
      #RightPanel
      {
           width: 150px;
           position: absolute;
           top: 0px;
           left: 600px;
      }
    23. Add this code to your CSS before #Photo. This will be a style for the Footer. The Footer is a special problem, because we want it to show up under the other layers, but we don't know what size those layers will be!
      #Footer
      {
          display: none;
      }
    24. Add this code to your CSS before #Photo.
      body
      {
          text-align:center;
      }
    25. Add this code to your CSS in the Wrapper
      width:750px;
      margin: 0 auto;
      text-align: left;
      position: relative;

Nora McDougall | Missoula, Montana 59801 | 406.253.4045 | Contact Nora
© 2010, Nora McDougall-Collins