1. Computing

How to Build a 3-Column Layout in CSS

By , About.com Guide

9 of 9

The Final HTML/CSS

Here is the entire document, HTML and CSS:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>Untitled Document</title>
 <style type="text/css">
 html, body {
 margin: 0px;
 padding: 0px;
 border: 0px;
 }
 #container {
 width: 870px;
 margin: 0 0 0 20px; /* top right bottom left */
 padding: 0;
 background-color: #fff;
 }
 #container h1 {
 margin: 0;
 padding: 0;
 width: 100%;
 height: 150px;
 float: left;
 border-bottom: #c00 solid 3px;
 }
 #container #col1 {
 width: 250px;
 float: left;
 }
 #container #col2outer {
 width: 610px;
 float: right;
 margin: 0;
 padding: 0;
 }
 #col2outer #col2mid {
 width: 300px;
 float: left;
 }
 #col2outer #col2side {
 width: 300px;
 float: right;
 }
 #container #footer {
 float: left;
 width: 870px;
 border-top: #c00 solid 3px;
 }
 </style>
 </head>
 
 <body>
 <div id="container">
 <h1>My Header Row</h1>
 <div id="col1">
 <p>Ut aliquip ex ea commodo consequat.</p>
 </div>
 <div id="col2outer">
 <div id="col2mid">
 <p>Ut enim ad minim veniam.</p>
 </div>
 <div id="col2side">
 <p>Nam libero tempore.</p>
 </div>
 </div>
 <div id="footer">
 <p>Copyright © 2008 </p>
 </div>
 </div>
 
 </body>
 </html>
  1. About.com
  2. Computing
  3. Web Design / HTML
  4. CSS
  5. CSS Tutorials
  6. How to Build a 3-Column Layout in CSS - Step-by-Step

©2013 About.com. All rights reserved.