The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Clearfix to much?? Re: Clearfix to much??


I think really it depends which version you mean. I would say that the one with support for old versions of IE is a little overkill but that rather gets into the debate of supporting IE in general. The most progressive method simply consists of:

.element-with-floated-objects:after {
content: “”;
display: block;
clear: both;

As this uses a pseudo class selector, some more weird stuff is needed for IE7 and down:

* html .clearfix { height: 1%; }
.element-with-floated-objects { display: block; }

In my opinion, this is fine – especially the more modern one – as other methods (like setting `overflow:hidden ` on the container) can have annoying knock-on effects.