Float everything.
If you have a floated div
inside a non-floated div
, everything gets all screwy. That's why most CSS frameworks like Blueprint and 960.gs all use floated containers and divs
.
To answer your particular question,
<div class="container">
<!--
.container {
float: left;
width: 100%;
}
-->
<div class="sidebar">
<!--
.sidebar {
float: left;
width: 20%;
height: auto;
}
-->
</div>
<div class="content">
<!--
.sidebar {
float: left;
width: 20%;
height: auto;
}
-->
</div>
</div>
should work just fine, as long as you float:left;
all of your <div>
s.