Text 26 Jun Clearing floats the very easy way!

Why has this simple technique taken so long to emerge? The float clearing problem has been around as long as CSS based layout. It has been a big problem!

The W3C always recommended the clearing element fudge that invalidated their aim of producing fully semantic code, hypocrisy.

A method I helped developed with a former colegue was even the fashion for a few months, making onto positioniseverything though not for long as it involved a fudge where margins were shunted up and then down by 32767ems, a bit nasty. The content-after method soon replaced it as it was far better.

The content-after method has been the main way things have been done for the last couple of years or so and seemed to be the simplest but again it was a little wrong, placing a CSS generated full stop within the DOM, if not the markup.

This is simple, put overflow: auto round the div that is to wrap the content, obvious and simple but no one has realised it. Developers like to think they are clever so how was there such a collective fail!

By the way it works great, thanks Paul :)


Design crafted by Prashanth Kamalakanthan. Powered by Tumblr.