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)
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).
Real Talk with Uncle Tim and the Berners-Lee
(I really like pluralizing the first half of hyphenated things)
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.