Blogless: Blog of Design Less Better.

Posts tagged .

My Favorite CSS Trick

Have you ever wanted to clear a floated HTML element without the need for messy and unsemantic structural markup? Well, if you have, and you haven't already heard the good news, I've got a technique that's going to make you jump for joy.

On this fine July morning, like to just take a moment of your time to eulogize what is, as far as I'm concerned, the most useful CSS trick I've ever run across. I've used this about five hundred times in my life, and I wanted to take the opportunity to address it to you, good reader, as if by some chance you haven't yet run into it.

I've chosen this opportunity, partially, because trend leader 37signals announced last week that they're dropping support for IE6 in their products. Which, in my immediate (albeit short-lived) joy, caused me to imagine a world where we could all stop supporting IE<=6, and, subsequently, in which this trick would become even more elegant and universal.

This trick was introduced to us all under the sign of How To Clear Floats Without Structural Markup. It is a trick developed by Tony Aslett and published at Position is Everything.

It makes it possible to clear floats without any unnecessary, unsemantic or hacky structural markup.

These icons link to social bookmarking sites where readers can share and discover new web pages.
PaulJul 9, 2008
 

The Numbers Don’t Lie: Math speaks about Conditional Comments

When it comes time to choose which users to punish for Internet Explorer's broken family of rendering engines, making the right choice should be as easy as 11 minus 2.

We all know the scenario. Some movie protagonist is facing some movie antagonist, and the antagonist tells him to choose who dies, his (insert family member) or his (insert other family member). Always, always our good-hearted protagonist offers himself first. Only very rarely does this work.

Screen capture from Donnie Darko, the movie.
Donnie Darko, because his enemy is metaphysical, chooses himself. Ontic enemies rarely allow this.

The rest of the time, our insidious villain makes some smart comment, and we're back to square one. The Internet Explorer team's smart response to our valiant attempt to save all our users was to provide us the conditional comments specification. Please note, the villain will never just decide to give up his evil ways at this point. Never.

These icons link to social bookmarking sites where readers can share and discover new web pages.
PaulMay 2, 2008
 
Close this
E-mail It