Ask HN: Is it just me, or is CSS too damn hard?
499 pointsI'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 commentsThe first thing you need to understand is how a page behaves when it’s _unstyled_. I mean when you haven’t implemented your own CSS. It turns out that there is no such thing as an unstyled page because the browser comes with its own default CSS.
At that point you have to get a feel of how each type of element (block, inline, table, list…) is rendered. Turns out that you’ll that if you understand block and inline elements, you’re halfway there (that’s actually what my second chapter will cover).
When I started writing CSS, I wrote it by hand in Notepad++, line by line, with no autocomplete. I think you need to go through that process to understand each property first, and learn what it does.
Send me an email and I’ll send you a draft of my book. If I can solve your problems, it’ll mean I’m on the right path.
Use Flexbox. It makes layout so much more straightforward.
This is an awesome resource for learning Flexbox that you can use as a reference until you don't need to anymore: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
> I have no idea which colors "go" with which ones, and pretty much all fonts look like the same for me.
This isn't about learning CSS, this is about learning design, which is a completely different game.
This is not to say that developers are incompetent with CSS, in fact, it probably says more about CSS than it does about the developer. The fact that CSS has gotten so convoluted is counter to its original goal.
Perhaps I have just work with companies who don't have an A-class developer team? I don't know. But it's not unusual for developers to straight up tell me "I'm not a CSS guy". Like... really? Who is then?
The issue has been more a case of it would be better not to and the design being incomplete (being most frequently static mocks) it hasn't fully captured the interaction, all scenarios or device widths. Designers need to really understand the medium they are working with and meet devs halfway.
Good design is function over form and working within constraints. All too often in the industry the designs are created as though they are for print. This is in large part also due to the fact designers tooling itself was designed for print and we are just now beginning to have better tools for designing interfaces but there is a long long way to go.
I don't think it helps that most of the CSS I've seen in the wild is vastly over-complicated.
All comments shown.
Couldn't load more comments. Check your connection and try again.