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

Earlier comments
kearneyandy#
It clicked a bit more for me understanding the box model better. More recently flexbox makes things a lot more clear/easier and handles a lot of those problems by default. I have no idea how design works, that seems a bit more art.

EDIT resources
I personally love https://cvan.io/flexboxin5/ for testing and https://flexboxfroggy.com/ for learning flexbox

coffeefirst1 reply#
CSS is great, but its poorly taught. I've known so many developers of all skill levels who get stuck somewhere between "I can make it red but I have no idea how to apply all these random properties into the layout I want." They'd ask me for resources, and I couldn't find one I thought was very good at that.

So I tried to write one.
https://whatisjasongoldstein.github.io/buildcss/
What's nice about this is I wrote it for real people, tested it on them, applied their feedback... etc. It's a little old now (this was before widespread Flexbox support) but it's specifically aimed at the sorts of problems you described.

wieghant#
I liked the no bootstrap section. People lack the foresight of shooting themselves in the leg. Currently working on a project where the front-end guys ended up using !important for literally everything due to lack of knowledge on how Bootstrap works.
weliketocode1 reply#
It sounds like you just haven't put in the effort/time. I very much doubt that CSS is "too hard" for you.

I've had similar experiences with regex, shell, & vim. If you're not doing it all the time, it's easy to just brush it off to the side or google whatever you need to do.
No reason to be an expert in something you're only going to use once in a while.

ummonk#
I would put regex shell and vim all in the same bucket as being esoteric and hard to learn since they don’t replicate any of the normal syntax and patterns you are used to. Actually, they are arguably even weirder than CSS.
Skunkleton1 reply#
My frustrations w/ CSS stemmed from not having respect for the complexity of the problem that CSS solved. I went into it w/ the same attitude of "hey, just center this thing", and didn't really get anywhere. These days I have accepted that CSS is a tool for pros, which I am not.
exodust2 replies#
> hey, just center this thing

Step 1: On your container div...
display:flex; justify-content:center; align-items:center;
Step 2: There is no step 2.

bsamuels2 replies#
this won't work on bootstrap elements
seekingcharlie#
Are you using the bootstrap’s utility classes?

.d-flex.align-items-center etc

exodust#
Another reason to avoid bootstrap if possible. I wouldn't touch that thing with a 10 foot div.

Each to their own, but it's better to make your own templates, unless your primary role is something other than frontend dev and you want the equivalent of store-bought pasta sauce instead of making your own pasta sauce.

lmm1 reply#
Yeah, with flexbox we can finally do the layouts we could do with tables since 1996, and it's only a little harder.
goto11#
With display:table from CSS 2 you could do the layouts you could do with HTML tables. Flexbox solves a different problem - for example you can't have rows and column in a flex. There is some overlap in functionality, but generally flex is more convenient to use.

Load more comments