Remix.run Logo
mannyv 6 days ago

Ugh, the syntax for CSS is just so crappy.

I know like 10-15 different languages, and CSS is by far the hardest to read and understand. It's easier to understand x86 assembly than CSS. CSS is basically pre-tokenized input that drives a renderer, but they sort of went halfway and didn't really make it real tokens or really human-writable.

I'd say that it should take the place of ASN.1 in the RFCs as an example of "what not to do."

lionelw 5 days ago | parent | next [-]

How many of those languages are declarative, or domain specific?

There's no use comparing CSS and assembly. It betrays a shallow understanding of CSS. Points to ponder:

- Assembly is superlatively imperative while CSS is the opposite. The difference can be jarring for some. It's commonly felt in day-to-day frontend work that switching to CSS (declarative) from almost anything else (imperative) -- JavaScript, PHP, etc. -- requires a significant mental shift, though it does get easier with experience.

- Lot of the vocabulary and concepts used in CSS come from outside the computing world, namely design and publishing. It's somehow a rarely shared factoid, but it's a hint at how too far away from Kansas we are to be making fair comparisons.

- A pervasive mistake that coders make (and unfortunately a lot of CSS teaching material out there too) is to approach CSS as a set of explicit, atomic instructions -- a fair coder-y assumption, but a bad mental model that leads to frustration. Understand that these instructions can affect one another; some switch entire layout algorithms[0] in a given scope, changing how other instructions behave (predictably).

[0] https://www.joshwcomeau.com/css/understanding-layout-algorit...

ZYbCRq22HbJ2y7 6 days ago | parent | prev | next [-]

> I know like 10-15 different languages, and CSS is by far the hardest to read and understand.

CSS is hard to know, even if you know 15 languages.

I can understand many programming languages and write in a subset of many of their features, but I wouldn't claim to know them. That would require a monumental amount of day to day effort, in my opinion (see https://en.wikipedia.org/wiki/Illusion_of_explanatory_depth).

To me, the best way to understand CSS is to evaluate it after rendering, and I have been writing it for decades.

icedchai 6 days ago | parent | prev | next [-]

I feel the same way. I find it the worst part of the HTML / CSS / JS trio.

leptons 5 days ago | parent | prev | next [-]

How is "font-size: 12px" not human readable? I haven't found anything about CSS difficult to read or understand at all. It's really quite simple.

jy14898 5 days ago | parent | prev [-]

What do you mean by "CSS is basically pre-tokenized input"? Can you give an example of what you have trouble with?