Class 05B

Two Column CSS Layout
Basic HTML: Two column layout
<html>
<head>
<title></title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">

<div id="header">
</div>

<div id="content">
</div>

<div id="sidebar">
</div>

<div id="footer">  
</div>

</div>
</body>
</html>

Note that the only difference between the one-column and two-column HTML is the addition of the <div> for the right-hand “sidebar” column. (In red above)

Basic CSS: Two column layout
*{
    margin: 0px;
    padding: 0px;
}

body {
    margin-left: 0px;
    margin-top: 0px;
}

img {
    border: none;
}

#wrapper {
    width: 990px;
    margin-right: auto;
    margin-left: auto;    
}

#header {
    height: 150px;    
}    

#content {
    background-color: #FFF;
    width: 650px;
    float: left;
}

#sidebar {
    background-color: #CCC;
    width: 340px;
    float: right;
}

#footer {
    height: 50px;
    background-color: #f3f2f2;
    clear: both;
}

Note that the only difference between the one-column and two-column CSS is the addition of the CSS for the right-hand “sidebar” column, the floats and the clear. (In red above)

Two-Column Exercise: Art by Justine



Comments

No comments yet.

Add Yours

  • Author Avatar

    YOU


Comment Arrow




About Author

jamie

Instructor for Graphic Design 65