Lurker News
Hey HN,

I'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 12 of 150

adrianhel3 replies#
The tipping point for me was memorizing "A complete guide to flexbox" from the site "CSS Tricks" by using flash cards (Anki).

The problems with CSS are:
- A lot of features have been abused before there were good layout features in CSS. *
- Errors are silent and you can repeat rules.
- Selector specificty is a major fail in the language IMHO. *
- Everything is global. *
* An example: floating an image is an excellent way of wrapping text around an image. Inline blocks are excellent for inserting layout in the middle of text. Neither are ideal for creating a layout. Flex and grid has now fixed that however.
What helps is to internalize the core concepts and to never "slap on another rule" when things just don't work. Start from scratch and update your mental model.
* CSS-in-JS bypasses the issue of global selectors. And when CSS is localized, specificity becommes a none-issue. Check out styled-components for either React or Vue. When IE11 dies and Edge turns Chromium, shadow DOM will probably become the standard way to solve this.

adrianhel1 reply#
Multiple asterix are stripped it seems.
TeMPOraL#
Asterisks are used for emphasis here:

  *like this*
  =>
like this

Footnotes we do usually do with a different mark here; some use square brackets [0], others use superscript chars¹, and I've also seen daggers† around.

arvinsim#
> The tipping point for me was memorizing "A complete guide to flexbox" from the site "CSS Tricks" by using flash cards (Anki).

That page was a godsend. It's one of my most accessed bookmarks :)

lloeki#
> Everything is global

Shadow DOM and WebComponents to the rescue!