Although Clearing floats are the right way, sometimes there is another way you can do this:
float your outer div too !!!
.outer { float: left; }
That way, the outer one will respect pop-up children and expand, but you will also need to pop up the parent div of the outer element, and so on, until an ancestor div div is cleared, which is cleared / <body> .
All floats are like brothers, so they go along with each other much better than non-floating undisclosed divs.
:)
source share