There are two "new school" methods. One is overflow and the other is clearfix.
new school #1:
#el {
overflow:hidden;
zoom:1;
}
A value of anything but visible
to overflow creates a new block formatting context which causes floats to be automatically cleared.
new school #2:
#el:after {
content:"";
clear:both;
display:block;
}
#el { zoom:1; }
The clearfix basically generates an invisible whitespace "element" that is block-level and clears the area after the element. It's a CSS replacement for inserting a blank div that clears for you.
If you need an element that goes outside the boundaries, use #2. Otherwise, use #1. The zoom
triggers hasLayout, and causes the el to contain floats in pre IE7. IE7+ understands the overflow:hidden
.
EDIT: As Grillz pointed out, content: "\0020";
is actually the newest, newest property value for the clearfix if you go that route. There's a rendering bug which occurs in regards to whitespace which can be resolved by specifying that instead of a period, empty string, or one space string.