DEV Community

Discussion on: Let's build a Perfect CSS Framework

Collapse
 
chinchang profile image
Kushagra Gour

One well-known solution we often see is to use single class selectors. No ID, no concatenation, no cascading. Just a single class selector to style anything.

Of course, there will could be a few actual requirements to concat/cascade classes. But our perfect framework would mostly always comprise of single class selectors. Moreover, it should also prohibit anyone from writing random selectors which again could be highly specific.

Collapse
 
alohci profile image
Nicholas Stimpson

This identifies in a nutshell why there can never be a "Perfect" CSS framework. It's too subjective. I'd hate a framework that stopped me from exploiting specificity correctly. And no framework can distinguish between correct and incorrect use of specificity.

Thread Thread
 
chinchang profile image
Kushagra Gour

Maybe that "perfect" framework that doesn't allow specificity to rise above one, except in certain cases where it's required and doesn't harm as much. Now, this is all theoretical talking. We can come up with examples and debate over them. Do you have any specific examples where you would want a selector specificity more than one?