Clearing Floats





2
Date Submitted Mon. Oct. 10th, 2005 3:25 PM
Revision 1 of 1
Helper ryan
Tags Clear | CSS | Floats
Comments 1 comments
Clearing Floats
/* Our documents structure */
body {
        margin: 0;
        text-align: center;
        padding: 0;
        font: 11px/1.8em Verdana, Arial, Helvetica, sans-serif;
}

#container {
        margin: auto;
        text-align: left;
        width: 760px;
}

#header {
        border-bottom: 1px solid #ddd;
        height: 80px;
        margin-bottom: 20px;
}

#content {
        float: left;
        width: 500px;
}

#sidebar {
        float: right;
        width: 240px;
}

#footer {
        border-top: 1px solid #ddd;
        margin-top: 20px;
        padding-top: 3px;
}

/* This will clear the float in Internet Explorer */
.clearfix {
        clear: both;
}

/* This will force the clear in browsers such as Mozilla and Safari */
.clearfix:after {
        clear: both;
        content: ".";
        display: block;
        height: 0;
        visibility: hidden;
}

Ryan Latham

www.unmatchedstyle.com
Ryan Latham
Unmatched Style

Comments

Comments where it will be useful
Fri. Aug. 18th, 2006 7:08 AM    Syntax Master sundaramkumar

Voting