Hacker News new | ask | show | jobs
by TylerH 2692 days ago
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.