DEV Community

Discussion on: CSS Is Hard - How do you learn to use and write CSS properly?

Collapse
 
antjanus profile image
Antonin J. (they/them)

For me, the difficult part has always been the actual cascade and working within that model of inheritance that's hidden in CSS but visible only in HTML. eg. the reason why a button color is green isn't because .button is green but because an element several levels up in HTML sets a color property.

And trying to compose styles within that paradigm. Meaning, trying to share styles, when to share styles, when to override, and how to compose distinct elements within each other.

Collapse
 
ciel profile image
Ciel

For sure. I am admittedly being spoiled by Angular's View Encapsulation. I hope that's the future of CSS.

Thread Thread
 
antjanus profile image
Antonin J. (they/them)

I use Angular's components styles, too! It's actually pretty powerful when coupled with a basic top-level framework for grids and when using SCSS so you can use shared utilities and settings! :)

Collapse
 
ciel profile image
Ciel

I do think that SCSS or similar should become the standard. There's no reason it shouldn't at this point.

With the way SCSS and other postprocessor syntax is structured, you can visualize the hierarchy better.

I also think people need to be taught about the magical unset value for any property.