3 ms·
the cascade has as many benefits as it has drawbacks, few people like to juggle specificities. IMHO the only important application of the cascade is in its ori
by afiori 3y ago
the cascade has as many benefits as it has drawbacks, few people like to juggle specificities.
IMHO the only important application of the cascade is in its original purpose: custom user defined stylesheets (today often via browser extension or adblockers), but you can add proper descriptive attributes to your markup for them.
- weo3dev 3y agoIn today's uses, cascade _with_ custom properties (the vars defined within :root ) are powerful and are what I leverage when providing theme-able ui libraries. Dark mode, light mode, large mode can all be solved using custom properties which to me most exemplify the power of the cascade.
- afiori 3y agothat is inheritance not the cascade: Inheritance allows for DOM nodes to use properties set on their ancestors, the cascade algorithm is how multiple conflicting rules interact and are overwritten. https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_... Custom properties are by default inherited by all descendant nodes (they also interact with the cascade, but it is less relevant) and this can be used with tailwind in a couple of different ways: https://stackoverflow.com/questions/64872861/how-to-use-css-variables-with-tailwind-css https://stackoverflow.com/questions/64872861/how-to-use-css-...