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
exodust#
> Is CSS an "art" thing?

No, but it helps to enjoy and respect visual layout challenges. Without appreciation of design, particularly web UI, you won't have much to aim for except MVP.
With programming, you are not usually switching back and forth between code and some visual layout element. CSS on the other hand, is an endless game of tweak, refresh, repeat. It's not for everyone.
BTW, Flexbox is now widely supported, and is much nicer to work with than trying to float DIVs, which nobody ever liked or found easy. Flexbox provides a nice way to center your elements horizontally and/or vertically, not to mention very nice control of spacing and item-level responsive sizing with flex-shrink.

alexbecker#
It sounds like layout is your primary problem (as it is most people's). You should view (the layout-specific parts of CSS) as a layout description language, which is a class of languages you've never worked with before, and so something that requires significantly more time investment than just learning a new syntax (e.g. JavaScript). My guess is you haven't put in that amount of focused study, so naturally it doesn't click for you.

This is not to say CSS doesn't deserve any blame--it's a bad layout description language, as evidenced in part by the fact that the recent grid+flexbox additions are much better (where supported) than old-school CSS.

talkingtab#
For me (maybe) its the size thing. I've never read anything about "content driven size" so maybe I just don't understand it, but I'm often confused about why some box (div) is the size it is. When I use dev tools to try to understand, nothing seems to help. I can see how the rules cascade, I see how the flexbox and grid things work, I can grasp the DOM and selectors - but then why is everything so small or so large...

The suggestion of building a page from scratch is good and helpful And the next time a CSS friend wants to learn JavaScript I will suggest they start by learning i386 assembly language :-)

abecode1 reply#
My wife is a technical designer for jeans and recently started learning web development because we moved and there wasn't much denim industry. She turned out to be good at CSS and I think it's similar to making jeans. From looking at the overall shape and style you can't easily construct a pair of jeans. People with artistic style can sketch a pair of jeans but to actually go from that to the specs that go to the factory (what a technical designer for denim does) is a different set of skills. Art is definitely a part of it but it's also a lot of tricks of the trade and processes, and this seems analogous to CSS.
tabtab#
Half the problem is that we got spoiled from WYSIWYG tools of yesteryear. Drag-drop-boom!-Done! But it turned into rocket science when dealing with web browser "auto-flow" and "responsive" design. Something that took 20 minutes in WYSIWYG now takes 4 weeks UNTIL you get proficient[1], and then the new different "in" layout framework comes along and you have to start at square 0 yet again. (Okay, maybe square 0.5 since some experience may transfer.)

It often seems like it would be easier to make 3 WYSIWYG designs for small, medium, and large screens. The device and/or server would pick the best fit of the 3. In other words, WYSIWYG x 3 < autoflow design time.
Reinventing 3 wheels is easier than reinventing one rocket.
Footnote 1: Often people fudge them to work most of the time, but glitches often show up over time as new browser or OS brands/versions come out and expose one's accidental fudging-based version lockin.

Load more comments