Things To Avoid When Writing CSS
Heydon
72560

Ordinarily I’m a fully paid up fan of Mr Pickering. In principle, I don’t disagree with the rules as written except that they don’t always apply.

A few years ago I would have fully endorsed this but for the problems I have to solve day-in day-out, some of these ‘things to avoid’ would result in a complete disaster. I’m thinking of the multiple files off the top of my shiny head.

Also this:

>Specificity should never be a problem because the most specific selectors should be the last ones you write.

This idealism is often impossible in practice as there are often multiple authors and you can never know what someone else will write (or where). Instead you sometimes need to devise an approach that by-passes the issue altogether. I’m not saying that’s ideal but I am saying that the suggestion here may well be impossible in practice.

I liked the disclaimer on this piece. I think it’s needed. My biggest bugbear with opinions on CSS authoring is that it isn’t ‘one size fits all’. Anyone with gravitas in this area should be making people aware that different problems require different solutions.

I just hope the readers of this have the common sense to evaluate their own needs.