DEV Community

Discussion on: Is CSS dying already?

Collapse
 
easrng profile image
easrng

I use CSS still, and don't find preprocessors necessary. CSS already has variables, and I like it's syntax just fine the way it is. I think, as a standard, and in terms of usefulness, it is growing.

Collapse
 
hendrul profile image
Raul Contreras

Vanilla CSS is terrible, low level, inheritance, a language on its own to give style, out of the context of where the real thing is happening (javascript), static, repetitive, I can only guess that you like it because you haven't understand other approaches. CSS will forever be the styling way for browsers, but will become a low level thing. Just look at flutter, try it, and we'll talk then

Collapse
 
easrng profile image
easrng

I have tried flutter, and I did not like it. It is an inaccessible mess, and it needs a build step.
If your main site content is JS, you are doing it wrong. Progressive enhancement is the way to go, never rely on any one component. No JS but have CSS? Great. It should work. JS and no CSS? Working too. CSS and JS but missing things like ES modules or CSS Variables? Let them use the noscript version. Inheritance is powerful and useful, and so is the cascade. I suggest you use CSS more, it takes time to get used to, but it is well worth it. Also, never write all your CSS by hand. Use the browser devtools, you can see changes live and in Chrome at least it has extras like a nice color picker, the shadow editor, and the timing-function editor. JS styling was tried before at Netscape, and it failed miserably. If you do not learn history, you are forever doomed to repeat it.

Thread Thread
 
hendrul profile image
Raul Contreras • Edited

You can do everything with css, but today there are better ways to apply css, like tailwindcss in combination with twin.macro and css-in-js. Have you tried tailwind?, it's not the same as bootstrap, it's focus is utility classes. Just using their playground you should see the huge difference to reinventing your own class names every time and repetition everywhere. I mean, css is going to be there always because it's pretty powerful, but there are higher level alternatives that are a boost for productivity without the having to pay with efficiency.

Thread Thread
 
easrng profile image
easrng

I don't like utility classes. If someone made something like tailwind but using css variables instead of classes, I'd jump on in an instant, if it had any benefits over vanilla. I like my content and styles seperate.

Thread Thread
 
hendrul profile image
Raul Contreras

With css in js everything is possible, you want separate styles? It got’s you cover, you have alternatives so you can lower the level when you need to, or use utility classes on other cases. Its definitely a matter of taste. I prefer styled components, css in jsx as properties, or tailwind

Thread Thread
 
easrng profile image
easrng

CSS in JS cannot style elements when JS is off, or in browsers without JS.

Collapse
 
adnanbabakan profile image
Adnan Babakan (he/him)

CSS is growing and that is awesome. Especially the latest updates which added variables. But preprocessors are still powerful, especially when it comes to the nested selectors.