My favourite 3 lines of CSS
Andy Bell has been obsessed with one particular CSS snippet for years now. In this post, he shares it with us and shows us how he’s recently improved it further by using Custom Properties.
Andy Bell has been obsessed with one particular CSS snippet for years now. In this post, he shares it with us and shows us how he’s recently improved it further by using Custom Properties.
Andy Bell writing for Smashing Mag:
The present and future of CSS are very bright indeed and if you take a pragmatic, progressive approach to your CSS, then things will continue to get better and better on your projects, too. In this article, we’ll look into masonry layout,
:is
selector,clamp()
, ch and ex units, updated text decoration, and a few other useful CSS properties.
Andy Bell recently shared his new CSS methodology oriented towards simplicity and consistency with “a heavy dosage of pragmatism.”
If there’s one thing you can guarantee in tech, it’s that someone, somewhere, will declare that CSS isn’t up to the job of “big projects” and what will undoubtedly be recommended by those same people will be either a JavaScript-heavy approach or some sort of all-in utility class approach like Tailwind.
The problem is, a huge number of projects are websites, so that advice normally doesn’t work for the vast majority of developers. For context, it’s estimated that WordPress powers around 36% of the internet and is still rising. Compare that to a paltry 0.3% of websites that use React, for example. It’s important to keep those figures in mind.
If you’re deep in CSS, you’ll want to read the whole post. Andy goes on to explain the methodology and how he writes CSS, then wraps up saying…
This isn’t a heavily documented, complex methodology. Well, not now, anyway. It’s more of a concept method of organizing CSS just enough to not pull to far away from the “classic” way of writing it. Really, it’s more of a thinking structure.
Andy makes three compelling arguments in favor of CSS. This conversation is ever more critical as our industry grows and matures.
It’s turning into a bit of a trend—particularly in the JavaScript community—to crap on CSS wherever possible. I could lambaste those who frequently do this, but instead, I thought I’d write about CSS positively to counter the falsities that are spread over the tech tyre fire that is Twitter.