Remix.run Logo
wewewedxfgdf 7 hours ago

My final conclusion about CSS is - program the damn machine.

What I mean by this is STOP every single type of abstraction/library/programming layer for CSS - nothing gets it right, everything causes a problem.

The ONLY way to deal with CSS is program it directly in the way the docs say, never anything else.

There's nothing wrong with using Bootstrap or whatever, and I definitely use JavaScript to program CSS. What I am saying is - no abstractions - no "better way" - no trying to turn CSS into something it isn't via whatever your new abstraction is that can be added to the N other abstractions that other people have made over the years.

Program the damn machine.

coffeefirst 2 hours ago | parent | next [-]

Yes. It’s been twenty years of watching people pick an fussy framework because they don’t want to learn the tool, then struggle to get the results they want because the framework is flawed but they didn’t learn enough to understand how and when to fight it.

And with grid, variables, animation, container queries, modern CSS is amazing. You just need to treat it with a little respect.

wewewedxfgdf 2 hours ago | parent [-]

Lots of developers feel they need a library to program anything - got forbid that you should program that actual machine.

ericwood 4 hours ago | parent | prev | next [-]

CSS suffers from one of its original design tenants in that it's very easy to throw some shit at the wall and kind of get it working without fully understanding it. This is especially true for people who have dabbled in it from time to time in their career when absolutely needed. It's rare to see someone sit down and learn it from first principles. It doesn't take long and knowing the basic theory goes a long ways!

antod 2 hours ago | parent | next [-]

I agree. I taught myself CSS1 by reading the spec (it was limited, small and simple). CSS2 was a lot bigger and way more complex but Eric Meyer's Salmon book helped a lot.

One problem (20yrs ago at least) was that for a long time the specs weren't supported very well by common browsers. So everyone just prodded at hacks using trial and error instead of learning it. That approach never really went away even after support improved.

jgalt212 an hour ago | parent | prev [-]

> CSS suffers from one of its original design tenants in that it's very easy to throw some shit at the wall and kind of get it working without fully understanding it

And dev tools made this feedback loop much faster.

paradox460 41 minutes ago | parent | prev | next [-]

I've been ranting about this for years, even wrote a blog post[1] a few years ago whinging about it. Nice to see others share the same sensibility

1: https://pdx.su/blog/2023-07-26-tailwind-and-the-death-of-cra...

yoz-y 7 hours ago | parent | prev | next [-]

For me nothing beats plain old classes and an external css file. For PWAs I just use lit css within the element, again with classes and plain css. If things cause problems, just figure out why and fix the classes.

jjpones 4 hours ago | parent | prev | next [-]

I've loved tailwind for the colocation of the component HTML and its corresponding styling (never gave up on traditional CSS though!), but with scoped styles I might start leaning back to traditional CSS.

herpdyderp 7 hours ago | parent | prev [-]

This is exactly how I feel. Learn how to write CSS! Like you would do with any language!

exogen 2 minutes ago | parent [-]

Your mistake is thinking that the authors of these frameworks (or their target audience) just don't know how to use CSS correctly. But it's far more likely that the authors know far, far more about the intricacies of CSS and how it works than most developers. These frameworks get developed because CSS scales terribly, not because of any fault of developers.

Namely:

- Selectors are a global namespace. Imagine if every variable and function in your favorite programming languages were global and so had to be unique. No modules or namespaces. Developing a system to fix that would be pretty high on my list of priorities... coming up with a cool solution and then people telling me to "just learn the language" would be pretty fucking infuriating, don't you think?

- Several fighting priority systems (did you know about newer ones like @layer?). And equivalent priority falls back to source order - OK, so how do you square that with dynamic loading? Some navigation paths through an app would inject some CSS first whereas others would inject other CSS first. Good luck!