3 ms·
I think it's the "cascading" part that makes it laborious. If I have an element with a class on it, there are multiple selectors that can affect it. It can be
by bena 9mo ago
I think it's the "cascading" part that makes it laborious.
If I have an element with a class on it, there are multiple selectors that can affect it.
It can be because it is contained within another element, because it is an element, because it has a class, because it is an element with that specific class, because it is next to an element, and many others.
And deciding which rule gets applied is work.
- b450 9mo agoWeb frontends have trended towards various forms of isolation (CSS scopes, shadow DOM), namespacing (CSS modules, BEM), or composition (tailwind etc.) because CSS cascading and inheritance cause more trouble than they're worth. So while you're correct, there are lots of available frameworks and patterns that provide a better dev experience, though of course there are tradeoffs involved in all of them.