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

odilontalk1 reply#
There are some use cases for Bootstrap for sure, but I feel you need grasp the basics of CSS first. It is like using jQuery for everything instead learn proper Javascript.
WestCoastJustin#
Until you get to the point where you are reinventing jQuery vs just using it. The same thing can happen with CSS, you are formatting all this stuff, getting a layout, spending tons of time fixing layout issues in CSS, etc. Where your time might be better spent just using Bootstrap and working on your app vs CSS.
aphextron1 reply#
Don't use bootstrap for anything beyond personal project prototypes. It ends up being a complete nightmare for maintenance. Coupling of DOM with presentation and state is the number one thing we should be avoiding in modern JS apps.
WestCoastJustin1 reply#
Interesting, I'll have to read about that. This has totally not been my experience.
aphextron1 reply#
It works great... for a while. Then you end up wanting to tweak something here and there, start adding classes to things, and you realize you want to do something that requires changes to the DOM within a component and you're screwed. Or you ignore the fact that the right way would be modifying the DOM, use some hacky CSS to kludge it, and you start getting browser inconsistencies. Either way you end up stuck with 100k of dependencies to style a popover and a dropdown that could have just been defined in a design system from the get-go and done with minimal CSS in a React/Vue type architecture scoped to the individual component.

Continue this thread — 1 reply

albertkawmi1 reply#
I think there is a spectrum Of skills with programming at one extreme and visual design at the other. Even within “front end” you tend to have JS experts and CSS/design/UX experts. Some people can do both.

When you consider UX, accessibility, progressive enhancement, cross browser and cross device support - there’s plenty to know. And unlike programming, it doesn’t all flow logically. Some stuff is subjective, other stuff requires specific knowledge of browser quirks etc.
The only site that helped me gain some _understanding_ of CSS (as opposed to knowledge, tricks and hacks) was this one http://learnlayout.com
It’s a bit dated now - Flexbox is mentioned at the end and CSS Grid is entirely absent - but still important if you’re supporting older browsers.
But CSS has never “clicked” for me. For a start the whole idea of cascade is based on inheritance and I generally prefer composition. I like designing UIs and it’s quite a satisfying challenge to match a wireframe to the pixel. But overall, I’d rather be writing application code.
If users could just read JSON everything would be a lot easier...

XCabbage#
I don't see get why anyone thinks that CSS skills and design/UX skills somehow go together. It seems to me that the skills needed to write CSS have more in common with those needed for programming than for UI design.
jwarren#
I can only assume that you're trying to run before you can walk. Remember that you're just defining a set of layout rules. You're not giving the browser specific instructions to follow. It seems that there's the temptation to assume that CSS is easy and simple, because it's for the web and isn't a proper programming language.

That is clearly not true. CSS describes a complex set of interactions which evolved over many years. You'll have to refer to MDN, experiment in your browser dev tools, etc.
Start in small and isolated chunks. Open a codepen with just a couple of divs and work out how their layout interacts.
I firmly believe that you can write beautiful CSS. Your list of languages shows that you are clearly interested in learning, and in expressing your needs in varied ways.
As an aside, I would recommend having a design on paper/on screen to implement before starting to write your CSS. Until you become relatively fluent with it, I think CSS relatively counter-productive as a design tool. Thinking about the target result as a separate step from implementing that result is going to be a much better approach.

magicmouse#
CSS is utter crap. In the history of computers, one programmed in a single language at a time. You had punch cards, then a text file in a terminal, then a text file in a PC written in a language like FORTRAN, COBOL, PL/1, Java, etc. And it was fine. Then they invent a bizarre 3 language sandwich where you switch back and forth between 3 completely incompatible languages (CSS, HTML, JS), which don't even agree on how comments are entered. It is one of the worst designed languages ever, surpassing the previous abomination RPG. I can't wait to deep six the whole HTML stack, as it is a huge time waster. We need a single, well-designed language that can all the general purpose coding we need (and generate websites). Maybe the output will be JS because that is what browsers support today, but seriously let's not put lipstick on a pig and call it pretty. That CSS can draw but not compute, and JS can compute but not draw, and HTML can't do IF, what kind of nutty design is this? Chaotic rapid growth was the cause, but the cure is to dump it entirely.

Load more comments