Tuesday 29 January 2013

Classless CSS

I found a very thought provoking article by Heydon Pickering on the Smashing Magazine website Classes? Where We’re Going, We Don’t Need Classes!. In the article, Heydon makes a strong case that the use of classes is
"as antiquated and inappropriate for styling as the table is for layout"
Heydon argues that tying semantic HTML to CSS classes is unnecessary and actually harmful to the interoperability of the HTML. Heydon naturally dislikes Object Orientated CSS as a further impediment to the purity (and therefore transportability) of the HTML. In his thinking, the HTML should be separated from the CSS, not tied to it via classes. To put it into his own words...
"An element that insists on looking the same wherever it appears is a bit like a Briton who travels from country to country refusing to speak the native language and burping the English national anthem. It’s aggressive and inappropriate."
Aggressive and inappropriate. I love that.

Q:

So what is to be done to introduce classless CSS?

A:

Paradigmatic styling.

Paradigmatic styling is using the right element for the job and styling it appropriately. We have a toolbox stuffed with tools with which we can apply styling to individual elements without resorting to classes. Appropriate use of microformats and CSS selectors make the use of classes highly suspect.

Conclusion:

Like I started out saying - this is a thought provoking article. I'm not sure I'm willing to go cold-turkey and forgo using classes in my CSS right away, but you can bet that I'm going to severely question my use of classes from now on.

Oh, and the comments posted after the article make fascinating reading!

No comments:

Post a Comment