3 ms·
You are only seeing it as a problem, because you do not understand the ”cascade” in Cascading Style Sheets. Set your typographic scale appropriately and learn
by eurasiantiger 4y ago
You are only seeing it as a problem, because you do not understand the ”cascade” in Cascading Style Sheets.
Set your typographic scale appropriately and learn to rely on the cascade instead of fighting it.
- brianzelip 4y agoHello `@layer`! https://developer.mozilla.org/en-US/docs/Web/CSS/@layer https://developer.mozilla.org/en-US/docs/Web/CSS/@layer
- eurasiantiger 4y agoOh great, more complexity. If only we could have good abstractions instead of mix’n’match utilities.
- klysm 4y agoNo I fully understand what is going on with cascading, it just makes composing classes hard. I use css variables for font sizes as multiples of rem.
- eurasiantiger 4y agoHow does it make composing classes hard? Genuinely curious what the exact difficulty here is. For the record, I don’t follow how the cascade applies in the context of an element declaring multiple CSS classes, as their precedence is defined by the order they first appear in CSS. If the problem seems to be in how descendant elements’ classes compose the cascade, maybe the affected styles could be scoped less broadly? Also, the @layer syntax seems to obviate this issue: simply define your typography on a different cascade layer separate from your container boxes and whatnot.
- klysm 4y agoYeah but why would you go through all that trouble when rem exists to solve this exact problem with font sizes.
- eurasiantiger 4y agoThat’s not exactly true — using rem does solve the problem, but certainly that’s not explicitly the use case it was meant for. I like being able to increase the sizings of all elements inside a container just by increasing the element’s font-size.
- klysm 4y agoI guess there is a use case for that, but I've never wanted to do that.
- eurasiantiger 4y agoIt comes in handy on large multi-brand enterprise sites where the same styles serve multiple domains. They are sharing layout but not necessarily the colors, dimensions, typography, iconography, or shape language. It makes sense to systemically separate concerns in an environment like that, because it makes the same developers able to efficiently work on any of the sites; developers meaning one or more in-house teams, possibly with external consultants.