Ask HN: Is it just me, or is CSS too damn hard?
499 pointsI'm a seasoned backend developer and systems administrator, with over 10 years of full-time programming experience. I've worked with anything from Assembly, C, Rust all the way to Python, Erlang, Elixir, PHP, Haskell, Lisp, Clojure.
When it comes to frontend, I have used React, Vue.js, ReasonML, Clojurescript and Elm extensively, and I know my way around web technologies in general. However, ever since I first started programming, I was NEVER able to get the gist behind CSS. I can't center my divs properly. I can't say "hey, CSS, this is the parent div, and all child divs must obey its size". I can't do anything basic on CSS without turning for help.
Incidentally, but very likely related, I always failed to have any glimpse into how design works. I have no idea which colors "go" with which ones, and pretty much all fonts look like the same for me.
I'd like to know the experience from fellow programmers. Is CSS an "art" thing? Is it common for other developers to have issues with it, or is it just me? Is there any material out there that made CSS "click" for you?
Comments (340) 150 threads
Show all comments
Showing thread 49 of 150
Interesting aside: what would the creators of CSS do differently today?
Bert Bos:
- Feels there was too little detail in the first CSS spec (but Håkon Wium Lie thinks there wasn't enough)
- Wishes there were more ways to display link behaviour e.g. expanding/collapsing text
- He wanted to create CSS syntax that was readable for people who were not programmers
- He preferred a full stop (period) to mark the end of a group of statements. Curly brackets (braces) to group statements was Tim Berner-Lee's idea.
- Grids should have been a fundamental part of the CSS spec from the beginning
- Prefers the idea of CSS for documents and a separate language for UI elements
- Thinks the cascade could have been made easier
Håkon Wium Lie:
- Feels there was too much detail in the first spec: the more you added to the spec, the harder it became to implement
- Thinks that margin collapsing was too complicated for v1 and could have been dropped
- Also thinks first-letter and first-sentence pseudo-elements should have been left out of v1
- Hypercard was based on the idea of cards rather than documents - he wished a CSS card element had been defined
- He didn't want border radius originally, but designers insisted and he now likes it
- The v1 spec was written without any test documents - he considers that a major mistake
- They both approached CSS in a document frame of mind and wonders if they should have considered the idea of web apps more
Source: https://www.youtube.com/watch?v=PQTpsxf7rQQ
I taught myself CSS by reading the CSS 1 spec back in the late 90s (mainly aimed at IE 4 - Netscape 4.6 sucked bad) before there were any books on it. I think the CSS 2 spec was also out by then too, but the browsers didn't support it yet (that took a surprising long time).
I found learning CSS 1 from the spec pretty easy as it wasn't a large spec and was fairly easy to read. The CSS 2 spec was a lot larger (5-10 times?), and a lot more complex with all the new stuff. Learning that took some help from the old Eric Meyer book from O'Reilly with the pair of trout (?) on the front.
The Eric Meyer book helped a lot with understanding fundamentals like how flow worked etc and properly grokking inline vs block etc. There wasn't really any of the tooling (eg Firebug and successors) to help back then.
Of course, I wasn't reading the specs to implement a rendering engine - just to use it.
I stopped doing any CSS about 8 yrs ago just as CSS 3 was starting to happen and never really learnt that. It seems way more powerful/complex/useful these days.
One tip that really helped back then was to try and do what you wanted with the very minimum of selectors/declarations to avoid conflicts, ambiguities and debugging difficulty. So creating lots of scratch empty test pages to explore one specific technique before including it with all your other CSS/HTML.