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 58 of 150

TylerH#
The main things you should learn to become decent at CSS are:

- the box model
- how cascading, specificity, and inheritance work
- googling CSS problems with the site:stackoverflow.com filter
Bit tongue-in-cheek with that last one, but the rest will give you a solid understanding of why certain things work the way they do when your code doesn't look the way you expect.
> I can't do anything basic on CSS without turning for help
The thing is, if you are working with a whole website (even simple looking websites can have a lot of HTML and CSS), then there are often no "simple" problems, at least with layout, because every element can and often does affect every other element.
Sometimes you just need a good old analogy or picture to demonstrate some things: https://stackoverflow.com/questions/33132586/why-isnt-my-mar... (disclaimer - I wrote that answer). In a lot of ways, your elements and their CSS are like rocks in a river... the water/document flows around them in certain ways, which affects stuff around them or downstream. Removing one or adjusting it can change how the water/document flows, and thus can affect other rocks/elements, etc.