Don't float the right column at all, just give it a large enough margin to fit the left column. Floating elements are removed from the normal flow of documents and do not affect the height of their parent; therefore, if you are floating both on the right and on the left, your red #box element has no height, and you do not see it; if you stop swimming in the right column, then it really determines the height of #box . If you don't #right_column at #right_column , then it will expand to use the entire available width in #box .
Something like that:
<div id="container"> <div id="box"> <div id="left_column"> <p>details stuff yada yada yada</p> </div> <div id="right_column"> <p>other stuff yada yada yada test test test test test stuff stuff content content content content content stuff stuff example stuff test stuff content content stuff content example</p> </div> </div> </div>
CSS
#container { width: 400px; } #box { background-color: red; } #left_column { width: 200px; background-color: blue; float: left; } #right_column{ margin: 0 0 0 200px; background-color: green; }
Updated script: http://jsfiddle.net/ambiguous/eDTdQ/
Alternatively, you can add width: 200px to #right_column and leave it floating, and then add overflow: hidden to #box so that #box expands to contain its floating children:
#box { background-color: red; overflow: hidden; } #right_column{ background-color: green; float: left; width: 200px; }
Live version of this approach: http://jsfiddle.net/ambiguous/eDTdQ/2/
If you want the right column to be stretched automatically, and you want both columns to be full, you can absolutely position the left column rather than float.
#box { background-color: red; position: relative; } #left_column { width: 200px; background-color: blue; position: absolute; top: 0; left: 0; bottom: 0; }
Live: http://jsfiddle.net/ambiguous/3Cxe3/
source share