Code smells in CSS – CSS Wizardry – CSS, OOCSS, front-end architecture, performance and more, by Harry Roberts

Code smells in CSS – CSS Wizardry – CSS, OOCSS, front-end architecture, performance and more, by Harry Roberts.

Reading this, I hang my head in shame as I recognize things I am guilty of.

There are CSS tools like http://csslint.net/ which purport to automate helping you write better CSS. It’s easy to think that CSSLint is just like JSHint, and will make your coding life happier. Don’t be fooled!

The notion of ‘code smells’ seems much more appropriate to good CSS than static analysis. CSSLint can anticipate some of the smells mentioned (overqualified selectors, using IDs in selectors) but there are so many things that CSSLint looks for that simply can’t be determined to be good or bad in a vacuum (see http://2002-2012.mattwilcox.net/archive/entry/id/1054/ for a nice writeup).

Leave a comment

Your email address will not be published. Required fields are marked *