Blog

the writings of

CSS Specificity Advice

July 28, 2014

Techniques and rules to live by when developing CSS style sheets.

Read Original Source

Great article. Words to live by.

These are rules I've been following for some time - and when I do, it makes the CSS much more maintainable over the long haul.

The one item I don't do and don't agree with doing is his section on "Safely increasing specificity" by doing things like this:

.btn.btn{ 
    /* one selector, double specificity */ 
}

That seems really hacky and (going back a ways) I've always heard that there can be a lot of hidden complications with using double-selectors like that (e.g. selecting based on 2 classes on the same element).

Article: Hacks for dealing with specificity

I'm also looking forward to watching the video he linked, 3.14 Things I Didn't Know about CSS

blog comments powered by Disqus