DEV Community

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

Collapse
 
ciel profile image
Ciel

I think what's hard about CSS isn't the language, but the archaic box model of 1999's tutorials that kludge the internet up.

The problem with CSS isn't the syntax, performance, or even really it's feature set. The problem is that it took so long for many standards to become universally adopted that the bulk of our tutorials, memories, books, and old websites are just filled with deprecated information.

The ecosystem is slow to change and we end up duct taping things together. Do that for 20 years and you may not realize that the duct tape is unnecessary by now. And you've been teaching others to use the duct tape.

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.