twitter bootstrap clearfix push down

clearfix, css, overflow, push, twitter-bootstrap

Solution

add this class to your CSS:

.row{
    overflow:hidden; 
}

DEMO

it is because of your `aside`, you set fixed width to `aside` and set margin to your `main-content`, this is not right way to put element side by side. but if you use percentage width to your `aside` and `main-content` and use `float` it will look good and there is no need for `overflow:hidden` (or auto).

look at this:

DEMO

#sidebar{
    float: left;
    width: 20%;   /*  instead 260px */
    position: relative;
    background: #ddd;
    display: block
}

#main-content{
    background: #FFF;
    position: relative;
    min-height: 600px;
    width: 80%;   /*  instead auto   */
    float:left;   /*  added          */
}

Problem

I'm using twitter bootstrap 3, to design a layout, which has two columns, a float sidebar and a main content with a left margin relative to the sidebar size, but when I use the clearfix class in an ul element inside the main content, seems that the clearfix class, clean the sidebar(float clear) and push the ul and subsequent content down. see http://bootply.com/97603 HTML ``` <aside id="sidebar"> <h1>Search Items</h1> <form id="searchForm"> <div class="form-group"> <label for="category">Category</label> <select name="category" id="category" class="form-control"> <option value="">Choose</option> <option value="1">Category 1</option> <option value="2">Category 2</option> <option value="3">Category 3</option> </select> </div> <div class="form-group"> <label for="term">Search Term</label> <input type="text" name="term" id="term" class="form-control"/> </div> <div class="text-center"> <button class="btn btn-default">Search</button> </div> </form> ``` CSS ``` body{ background: #F7F5FA; overflow-x: hidden; } .container-full { margin: 0 auto; width: 100%; padding: 0 15px; } #sidebar{ float: left; width: 260px; position: relative; background: #ddd; display: block } #sidebar #searchForm{ padding: 10px; } #main-content{ margin: 0px 0px 0px 260px; background: #FFF; position: relative; min-height: 600px; width: auto; } .gallery ul{ background: black; } .gallery li{ float: left; width: 120px; height: 120px; padding: 5px; background: #ddd; } .gallery li a{ display: block; } ``` How can i fix this behavior?

Original source