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
panic2 replies#
It's not just you. Treating the web like a native UI framework, where you can set pixel positions directly to get the perfect layout, isn't going to work. The trick to using CSS effectively is to give up on achieving whatever design goal you have. Instead, you should settle for what CSS actually lets you do. Don't try to align text to the pixel; change your design so it doesn't require precise alignment. Ideally your designers should also work in CSS so they can understand why nothing looks exactly like the images they produce.
perilunar#
Well you can do that (pixel perfect layouts) if you really want to or need to, and we often did in the early days, but that's really a failure to adapt to the medium.
tabtab#
Everything is "easy" once you learn it. Rockets and brain surgery are second nature to experienced rocket scientists/engineers and surgeons.

As I mentioned elsewhere, something that used to be quick and simple in WYSIWYG tools now have a giant learning curve and/or require lots of fiddling time to get working. It's hard to believe we must go from bicycle science to rocket science to make everyday software. We are not trying to make Mona-Lisa's, just get-er-done software that's relatively easy to use for end users. This alleged must-ness bothers me. It makes one feel there's a Grand Invention missing that will bring back the grand simplicity and speed of WYSIWYG tools.
It's as if we finally got flying cars in the 1990's (WYSIWYG tools), and then they are all yanked away from us and we are back to 2D roads.
Who shot the Jetsons?

jlengrand1 reply#
Might only partly related, but I have had the same exact problem for years until I start using web components.

Having to handle the CSS only for small bits at a time, in a contained environment made it much more logical and understandable to me. Most likely because it is more obvious to understand where to put specific CSS to achieve a certain behavior. I guess that small components tend to fit better with how my brain is wired as a mainly back-end developer.
I know react and others are also using the same strategies lately, but most of my experience is with WC.

jlengrand#
God I love downvotes without any explanations. I can't learn anything from it :S
mrtejas99#
Well, CSS is an obligation. You have to use it for front-end whether you like it or not. Even for me it kinda always problematic to use
atoav#
CSS is not hard. But there are certain things that are (needlessly) hard to solve with CSS. But it certainly got better with CSS3

Load more comments