Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Clearing floats

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 614
    Comment on it

    A common problem with float-based layouts is that the floats' container doesn't want to stretch up to accomodate the floats. If you want to add, say, a border around all floats (ie. a border around the container) you'll have to command the browsers somehow to stretch up the container all the way.

    The problem

    Let's try it. This is the CSS we'll use throughout the page:

    div.container {
        border: 1px solid #000000;
    }
    
    div.left {
        width: 200px;
        float: left;
    }
    
    div.right {
        width: 200px;
        float: right;
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: