Remix.run Logo
jfengel 3 days ago

No shame in that. I keep struggling to figure out the point of view of the CSS designers.

They don't think like graphic designers, or like programmers. It's not easy for beginners. It's not aimed at ease of implementation. It's not amenable to automated validation. It's not meant to be generated.

If there is some person for whom CSS layout comes naturally, I have not met them. As far as I can tell their design goal was to confuse everyone, at which they succeeded magnificently.

alwillis 3 days ago | parent [-]

> I keep struggling to figure out the point of view of the CSS designers.

Before 2017, the web had no page layout ability.

Think about it. Before the advent of Flexbox and CSS Grid, certain layouts were impossible to do. All we had were floats, absolute positioning, negative margin hacks, and using the table element for layout.

> They don't think like graphic designers or like programmers. It's not easy for beginners.

CSS is dramatically easier if you write it in order of specificity: styles that affect large parts of the DOM go at the top; more specific styles come later. Known as Inverted Triangle CSS (ITCSS), it has been around for a long time [1].

> It's not aimed at ease of implementation. It's not amenable to automated validation.

If you mean linting or adhering to coding guidelines, there are several; Stylelint is popular [2]. Any editor that supports Language Server Protocol (LSP), like VS Code and Neovim (among others), can use CSS and CSS Variables LSPs [3], [4] for code completion, diagnostics, formatting, etc.

> It's not meant to be generated. Says who? There have been CSS generators and preprocessors since 2006, not to mention all the tools which turn mockups into CSS. LLMs have no problem generating CSS.

Lots of developers need to relearn CSS; the book Every Layout is a good start [5].

[1]: https://css-tricks.com/dont-fight-the-cascade-control-it/

[2]: https://stylelint.io

[3]: https://github.com/microsoft/vscode-css-languageservice

[4]: https://github.com/vunguyentuan/vscode-css-variables

[5]: https://every-layout.dev

naasking 2 days ago | parent [-]

Developers can learn a new programming language in a few weeks to months of just using it. If they can't learn to reliably and predictably use CSS in the same way, then I'd say that makes CSS flawed.

alwillis 2 days ago | parent [-]

> If they can't learn to reliably and predictably use CSS in the same way, then I'd say that makes CSS flawed.

It's not the fault of CSS that most developers don't learn to use it correctly. That's like blaming the bicycle when learning to ride one.

Frankly, it's not a priority for most of them to learn CSS; they don't see it as a "real" programming language; therefore it's not worth their time.

naasking 2 days ago | parent [-]

> It's not the fault of CSS that most developers don't learn to use it correctly. That's like blaming the bicycle when learning to ride one.

It's not like blaming the bicycle, that's the whole point of my analogy to programming languages. Like I said, learning a new programming language in a few weeks of regular use is a common experience. This also happens with bikes, because you can try a few things, lose balance, make a few intuitive adjustments, and iterate easily.

This just doesn't work with CSS. There are so many pitfalls, corner cases and reasoning is non-compositional and highly contextual. That's the complete opposite of learning to ride a bike or learning a new programming language.

You literally do need to read like, a formal specification of CSS to really understand it, and even then you'll regularly get tripped up. People just learn to stick to a small subset of CSS for which they've managed to build a predictable model for, which is why we got toolkits like Bootstrap.

Edit: this also explains why things like Tailwind are popular: it adds a certain amount of predictability and composition to CSS. Using CSS was way worse in the past when browser compatibility was worse, but it's still not a great experience.