CSS container doesn't stretch to accommodate floats

css, css-float, html

Solution

Add `overflow: hidden;` to the `.container` selector. This will force the container to acknowledge that it has children.

Problem

``` <html> <head> <style type="text/css"> .container { width: 900px; border: 2px solid #333333; padding-top: 30px; padding-bottom: 30px; } .container_left { border: 2px solid #FF00FF; width: 650px; float: left; } .container_right { border: 2px solid #0000FF; width: 225px; float: right; } </style> </head> <body> <div class="container"> <div class="container_left"> <div>LEFT CONTAINER</div> <div>LEFT CONTAINER</div> <div>LEFT CONTAINER</div> </div> <div class="container_right"> <div>RIGHT CONTAINER</div> <div>RIGHT CONTAINER</div> <div>RIGHT CONTAINER</div> </div> </div> </body> </html> ``` The result is: I want a result like this:

Original source