Live data from Hacker News

Ask HN: Is it just me, or is CSS too damn hard?

news.ycombinator.com

1–10 of 358 posts

Ask HN: Is it just me, or is CSS too damn hard?

#1
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?

Re: Ask HN: Is it just me, or is CSS too damn hard?

#3
It's not just you. I'd recommend using a CSS framework. Have you checked out Bootstrap [0]? I was very much the same way (focused on backend). CSS is just a means to an end for me, in that I just wanted something that doesn't look like total garbage, so I used Bootstrap for the frontend bits. Allows you to quickly get up and running using the examples without learning too much CSS [1]. Just find something that looks like what you want and then copy/paste. Much much easier.

They have a pretty nice grid system that allows you all types of formatting options (desktop/mobile). All types of text formatting options too. Honestly, I think you're way better off learning something like Bootstrap unless you want to do this professionally.

[0] https://getbootstrap.com/

[1] https://getbootstrap.com/docs/4.2/examples/

EDIT: downvotes? Why not mention why you don't like bootstrap and share with the larger thread? At least, then it is useful to everyone else.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#4
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.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#5
>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.

Yeah, you're not a designer.

Note I'm not insulting you. :)

CSS is very much like magazine or print layout IMO. If you're not used to that, it won't gel well. If you think of layout from a design perspective and _not_ a programming perspective, it's really not that bad. The warts more come down to differing implementations across browsers, which has become far less of an issue in recent years.

I expect you'll get a very different response from the crowd here, though, so consider it my two cents. I've done much backend work (like yourself) but started in frontend, so I feel adept enough to work with CSS well when I need to. shrug

Re: Ask HN: Is it just me, or is CSS too damn hard?

#6
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

Re: Ask HN: Is it just me, or is CSS too damn hard?

#7
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.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#8
As far as small projects go, it's useful to take what you've learned from larger projects like Bootstrap, and use a subset of that knowledge.

For virtually everything else in production, you should be using themed Bootstrap or CSS framework x, y, or z that fits to your corporate identity. Usually so you can have a front-end engineer make decisions about symbols and have those changes flow out to the rest of your webpages and web apps without relying much on engineering to hand tune everything all over again. This is sort of ideal CSS usage, though it's probably debatable by folks here.

CSS is development more than it is design. It just helps you accomplish design.

Maybe one of the points glanced over CSS discussions is that the traditional visual formatting model was designed for documents, and not web page and web app layouts for today's world. That's better addressed by flexbox and CSS grids. For instance, the entire concept of floats isn't for aligning things, it's for text to flow around "floated" boxes like images. Most hacks like clear fixes were designed to help utilize floats for page layout versus document composition.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#9
I hate css, but one of my colleague (who's really good at it) told me once that people have problems with css because they don't study and take it seriously. I.e. I spend so much time reading on new languages and design architectures, but besides some articles here and there I don't study css or take it seriously at all. So yeah, there you have it.

I also think it's getting better. One major problem with css was getting it to work across all browsers, but now if you're lucky enough to only have to support modern versions it's so much easier than it used to be!

Re: Ask HN: Is it just me, or is CSS too damn hard?

#10
The thing with CSS is it's not a programming language. Progamming skills and CSS skills are almost completely orthogonal. It is simply a domain of practical knowledge that takes years and years of dealing with all the idiosyncracies, cross browser issues, and silly warts of historical legacy that come with it to master. That being said, it is without a doubt the most powerful and simplest layout tool in existence. Things like QT can come close, but really nothing else is as as simple and easy to use while still being extremely performant and highly customizable. There's very very good reasons why practically all software nowadays has gone to HTML/CSS based UIs.
Post reply on HN