CSS specificity mini tip of the day that I have to show is one you may or may not know about but it is sometimes handy. When in the CSS world do you ever find yourself having to use the blasted !important? It's ok to admit to using it, sometimes for speed I use it (terrible I know). But over the last few months I've been using another little trick that can help you, especially in the world of BEM CSS.

If you have a nice class and it's being overwritten by another rule and you don't want to have to use !important or a more specific comple rule then try this:

[css] .rule {color:red;} .rule.rule {color:blue;} [/css]

Just repeat the rule and you have doubled it's power. Handy when you don't wish to use specificity or !important. Although I doubt when you may use this but still, something to know.

For specificity knowledge a great read is this one. It compares how markup, classes and ID's all relate to creating power via CSS rules.

Monthly Archives: January 2015

CSS specificity mini tip

CSS specificity mini tip of the day that I have to show is one you may or may not know about but it is sometimes handy. When in the CSS world do you ever find yourself having to use the blasted !important? It’s ok to admit to using it, sometimes for speed I use it

Read more