Open laustdeleuran opened 10 years ago
Harry Roberts says a couple of good things about specificity:
Do not nest selectors unnecessarily. If .header-nav {} will work, never use .header .header-nav {}; to do so will literally double the specificity of the selector without any benefit.
[...]
One thing I believe, as a very, very general rule of thumb, is that as sites get bigger, selectors should get shorter.
Another great read by him is Code smells in CSS
README.md, line 445
I totally agree with this! But I think it's important to highlight that people should avoid nesting, as it qualifies their selectors, and eventually ruins the idea of OOCSS/BEM - to control the cascade. Some nesting is unavoidable / unpractical, so I'd suggest that:
:before
Example: