Do We Need Specificity in CSS? (2015)
philipwalton.com
Do We Need Specificity in CSS? (2015)
1–10 of 53 posts
Re: Do We Need Specificity in CSS? (2015)
#2Re: Do We Need Specificity in CSS? (2015)
#3Of course, you can sometimes inherit a system that is one big specificity mess.
Re: Do We Need Specificity in CSS? (2015)
#4It's entirely possible that I'm missing some of the benefit here, but it seems to me that scoped styles etc largely already solve this problem.
Re: Do We Need Specificity in CSS? (2015)
#5Re: Do We Need Specificity in CSS? (2015)
#6There is however a small problem if you want to use many CSS files - that you need to link them in the correct order.
edit: Also I don't use ID's in CSS.
Re: Do We Need Specificity in CSS? (2015)
#7Warnings seem like the way to go for this? i.e. having a static analyzer to check that the specificity matches the declaration order. (Assuming that's possible... it's not obvious to me if there are theoretical roadblocks.)
Re: Do We Need Specificity in CSS? (2015)
#8Re: Do We Need Specificity in CSS? (2015)
#9It works extremely well, if everyone follows the rules, which is uncommon.
That goes for most of CSS; not just specificity.
CSS is incredibly powerful, if used properly, and specificity, when actually used properly, is very cool.
About ten years ago, I wrote this series: https://littlegreenviper.com/miscellany/stylist/introduction...
It’s still absolutely relevant nowadays, and just as few people follow that workflow now, as they did then.
CSS, in general, is too complicated (IMNSHO), but that complexity is also what makes it so powerful.
I’ve always enjoyed Stu Nicholls’ CSSPlay site, for examples of extreme CSS: http://www.cssplay.co.uk/menu/
Re: Do We Need Specificity in CSS? (2015)
#10Warnings seem like the way to go for this? i.e. having a static analyzer to check that the specificity matches the declaration order. (Assuming that's possible... it's not obvious to me if there are theoretical roadblocks.)