I feel like this article is just another: "CSS is hard, and instead of learning, use this clever method that works for me." Maybe I'm just old school because I learned CSS2 by reading the docs, and not as CSS in JS.
Do We Need Specificity in CSS? (2015)
51–53 of 53 posts
Re: Do We Need Specificity in CSS? (2015)
#52Earlier quoted context omitted.
why? custom.css would still be loaded, just that if any rules conflict between the two, the original stylesheet would win. if custom.css makes some text bold and red, and then a second stylesheet comes along and makes the text blue, the final text would be bold and blue. but with CSS specificity defining priority, whether the text is blue or red depends on which file has the gnarliest, most complicated selector. cust…
Ah, thanks for the explanation -- I thought that you meant that custom.css would be disregarded, now I see you meant that css _rules_ should use "last declaration wins". Not really a followup on my previous question: what would be done if, say one can't change the order: so custom.css is still before original css. In such cases, without the specificity rule, wouldn't the only option we'd have is to somehow inline the…
Re: Do We Need Specificity in CSS? (2015)
#53Earlier quoted context omitted.
BEM I think comes from choice to aggressively reduce complexity, not from ignorance. Sprinkled with a tiny bit of specificity classes for state, it combines best of both worlds.
then why is BEM more complex than just plain CSS? if the idea is to reduce complexity, that’s a giant fail.
You have to name things, then you don't have to apply multiple rules.