The Lonely Telecaster

Listening out loud while my guitar gently sleeps

One clearfix to rule them all

The concept of a clearfix didn’t really ring a bell for me until a couple of years into dedicated web work. It felt like a hack, maybe even a shortcut, and my instinct was that good old properly-syntaxed HTML and CSS would win the day.

I didn’t know what I was really talking about. Today, as we await final spec approval for Flexbox and eventual browser compatibility, we’re still in a place were block elements need to align themselves in some way.

If one doesn’t need to displace other elements, absolute positioning is always an option. But if vertical alignment needs to happen, you’re generally going to need to float something.

And that’s where a dependable clearfix can make life a lot easier.

 

Richard Tafoya • June 20, 2014


Previous Post