There are lots of articles on the web on how float works, but I'm not sure where it's best to start reading Maybe Paul has written about it somewhere?
Let's say you have something like this:
<p>and some more</p>
<p>some content after the container</p>
Float the two divs inside the container, then add a border to the container and watch what happens... The container will not wrap around the floated elements. The floats are removed from the document flow, and the container will collapse and have no height.
When you want to make sure the container contains all of its floated child elements, you could add the clearfix class to the container. There are a number of other ways to make sure it contains its children as well; the simplest is probably to add overflow: hidden; to the container.