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
d0m#
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!

nroviw1 reply#
CSS is not as difficult as many people think.

I believe part of the reason why developers have trouble with CSS is that they don’t ever try to write it from scratch. A lot of web development tutorials/courses/bootcamps often go in depth on JS and maybe HTML but always just slap in CSS frameworks to make things look nice as an afterthought.
I remember the first project I worked on as a web developer was to update the styles of an existing web app with very complex UI. It was hard as hell. But I was lucky to have worked with a senior developer who was a CSS wizard. He taught me that CSS is not magic although it is magical. If you don't give up, you can bring any designs to life.
Not knowing any better, I spent months playing, tweaking, learning how to style different components from scratch. I mastered selectors and the cascade, block model and floats, display and position types, a few tricks like using negative margin, constructing triangles from borders. I never stopped honing my skills. Before long I started learning about responsive design, transitions, animations, performance, and design systems.
CSS became a playground for me to experiment. It opened up a whole new world to express my imaginations. My advice for anyone aspiring to master CSS is to find some design inspiration that you like and just build it. You'll learn so much along the way if you don't give up. At some point, things will fall into place and you will realize just how wonderful CSS really is.

mattmanser#
No, as someone who's struggled, and seen other programmers struggle, with CSS way before bootstrap was released I can assure you this isn't true.
lazyjones2 replies#
The whole set of web technologies is a mess. We‘re still in the stone age of web UI design, similar to the 80‘s era of home computing when everybody built their own UI with basic drawing primitives. It’s going to take a while till decent, cross-platform/device UI libraries make progress and designers discover the value of reusable components that just work and are familiar to users.

Until then, we‘re stuck with terrible websites with, at most, one messy version full of ads for desktop computers, with much too small links/navigation elements for tablets (hi, HN!) and one clunky mobile version that looks horrible on most devices, particularly tablets.

api3 replies#
The sad thing is that by the 1990s we'd figured out how to do good UI design for desktops, but then we promptly forgot every single bit of that knowledge when the web came along.
lazyjones2 replies#
In the mid-90‘s the web wasn’t that bad, people used normal buttons, unstyled links and basic tables. The downward spiral started when corporations came and wanted their “CI” styling, then designers came and wanted to be “creative” and turned web pages into minigames where you have to guess what color or text style denotes a link, what the icons mean and how to trick the infinitely-scrolling website into displaying the footer. ;-)
gscott#
I have a lot of time messing with css that could have been solved in minutes using tables instead...
flukus#
And now we've come full circle with reader modes that disable all that crap the designers add.
the_pwner2243 replies#
But the web wasn't supposed to be a UI platform - it was supposed to be a medium for delivering text with some images and media occasionally interspersed. Hypertext markup language.

Java applets could use Swing to get a normal-ish desktop UI and still be close to the web. But we keep trying to cram a UI framework into HTML/CSS.
The standards are slowly mutating and eventually they may provide a good UI framework.
JavaFX and Qt are both modern UI frameworks. Both provide a drag-n-drop interface to design applications using standard widgets such as lists and tabbed panes etc. You can modify the styling with CSS (at least in JavaFX, I don't have much experience with Qt). But the final layout spec is done in FXML or the Qt XML format - the XML has s and and , with CSS used to style these elements and dictate their visual properties. Instead of divs and spans hacked with css/JS into becoming scrolling lists and tabbed panes or horizontal container boxes.
I know the basics of HTML/CSS and it took me half an hour to figure out how to put 3 images side by side. Because divs can't represent that naturally - I had to use weird css and put 3 divs inside the outer div. In JavaFX you would put an HBox and drag three Images into it and it just works, because a HBox represents a UI concept instead of a document markup concept.

prewett2 replies#
I must be missing something, because isn't 3 images side by side just:


? But you're right, the web isn't a UI platform. It's designed for to produce things that are like Microsoft Word documents. Web-apps are like using MSWord's scripting and text layout to produce a MSWord-app. Yeah, one can do it, but it's like cutting a steak with a spoon.

Continue this thread — 2 replies

pjmlp#
I have been doing UIs since the mid-90's, with Turbo Vision being my first framework.

Naturally also Web based ones since early 2000's.
Share the feeling, everything is so much easier in native toolkits.
There is some hope though thanks to Web Components and Houdini.

api#
That gets onto a major tangent, namely the fact that the web took over as a UI due to the incredible pain and security nightmare (bad isolation) of shipping and updating native apps. The web was a way to avoid the hell of installing a native app, so the web won.

This is (still) a problem with OSes. Mobile improved the situation a bit but not really that much. I am now reluctant to install mobile apps since virtually every mobile app is a potential vector for who knows who to spy on me. Mobile apps are isolated enough that they're unlikely to trash the device but they still have huge security isolation problems.
TL;DR: endpoint OSes suck so the web won in spite of being a crappy UI platform.

onion2k#
Thinking about the apps I used in the 1990s, we definitely had not figured out good UI design. There were some good ones, but there were some terrible ones too. Remember Napster's interface? Yikes.
arvinsim#
> It’s going to take a while till decent, cross-platform/device UI libraries make progress and designers discover the value of reusable components that just work and are familiar to users.

I find it very unlikely that browser vendors will agree to have the same implementation across their own products, vested interests and all.

adrianhel3 replies#
The tipping point for me was memorizing "A complete guide to flexbox" from the site "CSS Tricks" by using flash cards (Anki).

The problems with CSS are:
- A lot of features have been abused before there were good layout features in CSS. *
- Errors are silent and you can repeat rules.
- Selector specificty is a major fail in the language IMHO. *
- Everything is global. *
* An example: floating an image is an excellent way of wrapping text around an image. Inline blocks are excellent for inserting layout in the middle of text. Neither are ideal for creating a layout. Flex and grid has now fixed that however.
What helps is to internalize the core concepts and to never "slap on another rule" when things just don't work. Start from scratch and update your mental model.
* CSS-in-JS bypasses the issue of global selectors. And when CSS is localized, specificity becommes a none-issue. Check out styled-components for either React or Vue. When IE11 dies and Edge turns Chromium, shadow DOM will probably become the standard way to solve this.

adrianhel1 reply#
Multiple asterix are stripped it seems.
TeMPOraL#
Asterisks are used for emphasis here:

  *like this*
  =>
like this

Footnotes we do usually do with a different mark here; some use square brackets [0], others use superscript chars¹, and I've also seen daggers† around.

arvinsim#
> The tipping point for me was memorizing "A complete guide to flexbox" from the site "CSS Tricks" by using flash cards (Anki).

That page was a godsend. It's one of my most accessed bookmarks :)

lloeki#
> Everything is global

Shadow DOM and WebComponents to the rescue!

Load more comments