All’s Not Clear for Overflows

Clearing floats have always been an annoyance for us as web developers, because it requires us to use empty markup. It wouldn’t be that much of a problem, except that using floats for complex css layouts has become somewhat of an industry standard.

Not too long ago a new trick came along which had many css developers feeling lighthearted – a way to clear floats without markup. It was a simple, reliable css method that’s been around for ages – the overflow property. Simply by declaring this (usually to auto or hidden), you are able to extend the parent div over the floated divs, and effectively clear your divs – something you have previously needed an empty block level html element to accomplish.

I am afraid, however, that this trick is too good to be true. While it may work well on simpler projects, the method becomes inherently buggy whenever mixed with or around JavaScript, specifically in the Safari web browser. Additionally, it fails to clear certain divs in IE6.

So, when it comes to clearing floats – I’d say stick to the markup method. At least until a real solution comes along.

2 Responses to “All’s Not Clear for Overflows”


  1. 1 Wolf

    Clearfix and it’s IE6 and IE7 solutions are very reliable… that’s your real solution there.

  2. 2 Zahnster

    Thanks for the tip, Wolf – Clearfix is a new one to me. It looks potentially cool; however I’m not a fan of all the ‘hacking’ that’s going on – most of the css declarations are limited in some way, and there’s a lot of compensation going on (the ie 1% hack, the firefox2 unsupport of inline-block).

    I’ll have to throw it through some real world tests and see how it handles.

Leave a Reply