The Unfortunate Simplification of CSS

I wrote the headline of this article 20 days ago. Someone had just tweeted an article about how CSS is bad and needs to be replaced by something — or something very close to that. I’m a human person with a job so I never actually wrote my response (I’m also an astoundingly good procrastinator).

But this article was never really about CSS. It was about how we learn. It was about how we set expectations. It was about how certain experiences limit our thinking. It was also about using the wrong tense and having fun.

CSS — The Early Daze

When Uncle Tim first invented the internet, there was HTML. It was good, but it was lonely. A few years later, feeling sorry for HTML, Tim’s BFF Håkon thought of CSS in the shower (it was originally called Cascading Shower Sheets). This was good. HTML had a friend and the internet could finally make text the wrong color.

Web developers (now known as Webmasters) spent the next 20 years telling every how easy CSS was to learn. It’s so great, you guys! Here’s how selectors work, just put them in a file with a bunch of dumb properties and your boss will be so happy with her new website! This is a great pitch, people love easy things, and Webmasters are notoriously lazy.

And this was fine for a while. For like 15 years this was fine. Websites were fun and dumb before people realized they could use them to make money. Then things started getting complicated.

Capitalism Ruins Everything

(That’s true about capitalism but this is about CSS or learning or something)

In recent years Webmasters have really gotten full of themselves. Everything has to scale, websites are big and complicated, it takes like 100 people to maintain Facebook. Have ya’ll noticed how weird JavaScript got? People are going nuts over that thing. This is all ok, it’s progress and progress is good. So we need to build bigger websites (they’re actually called web apps now, gramps). Certainly the tools Tim and Håkon so graciously built for us will still work.

As it turns out, sort of. People are mad about HTML, but there’s no JavaScript API for building a document (even React has to fake it, and you can totally tell). But CSS, hoo boy. Everyone wants to replace CSS with JavaScript. It’s so much more powerful! It has variables! NO MORE CASCADE.

I thought about getting FUCK THE CASCADE tattooed on my forehead so I could more easily land application developer jobs.

And again, this is progress. This means people are thinking of ways to solve a real problem. They’re all wrong, but the important thing is that they’re trying. You think Beethoven nailed his first painting? No, it was a picture of a mutant dog barking at a malformed tree about how Yarn is better than npm (Yarn users think npm stands for not programming much).

The truth is that CSS is not bad. CSS has just been poorly marketed. JavaScript actually had a similar problem a few years ago but then an ad agency called jQuery made everyone like JavaScript again.

Real Talk with Uncle Tim and the Berners-Lee

(I really like pluralizing the first half of hyphenated things)

There’s a major difference in how all of us were introduced to CSS, and how all of us were introduced to JavaScript. JavaScript is a Real Programming Language™. It’s hard. Your expectation going into it is that it’s going to be at least somewhat difficult to learn, and you’re going to have to work with the language to do what you want. Some people hit a few hurdles, go “JavaScript is bad,” and move on to a new language. All of those people work in fluorescent-lit offices, and all of those people are white men.

CSS is different. CSS has always been sold to us as a thing that is easy. There are no hurdles to start throwing green backgrounds under blue text. Most colleges don’t even offer a CSS degree. But there’s a very fine distinction between easy and simple. CSS, especially as you start building more and more complex applications, is far from simple. And since we’ve always pitched CSS as this easy thing, we haven’t prepared people for the architectural challenges that CSS presents.

Designing a CSS architecture for a large-scale web application is no different than designing a JS architecture for a large-scale web application. The only difference is in how Webmasters have been conditioned to think about CSS. CSS is fully capable of working at scale, you just have to spend the time actually learning how CSS works. CSS is actually hard, and that doesn’t make it bad.

Stop Being a Friggin’ Baby

Scaling every part of a web app is hard, even the easy parts. As you grow up you’ll realize everything is hard and terrible. Imagine if YouTube had just been like “nah CSS doesn’t work we can’t build this.” PewDiePie would be homeless because his only skill is being weird in internet movies.

Next time someone tells you CSS is bad, tell them they are bad. After you do that apologize and help them.

CSS is good and it’s hard and I like it.

Written by

Likes sandwiches, hates computers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store