There are several ways to clean floating elements:
1. Use CSS alias: after class
.container:after { clear:both; content:"."; display:block; height:0; visibility:hidden; }
Apply the container class to the widgetRow div. This approach is probably the most semantic, but it is not supported in all browsers, especially IE7 and below. browser support for: after
2. Use overflow: auto or overflow: hidden
.container { overflow:auto; } .container { overflow:hidden; }
Apply the container class again to the widgetRow div. This approach may be a little more semantic, but it can also come back to bite you especially when looking at smaller displays. overflow: auto can trigger a horizontal scrollbar when overflowing: hidden can hide an element all together. problems using oveflow to clean floating files
3. Use clear: both
.clear { clear:both; }
This is the approach you take in the belief that your clear class is similar to the one above. This is the only approach that I know that it is compatible in all browsers and will not give you unwanted side effects. Therefore, depending on which browsers you support, I probably stick with what you have.
source share