February 1st, 2019 | web development | 3 minutes
Is it always better to use CSS when possible instead of JS?
I love it when a Stack Overflow user asks a question like this in earnest.
“Of course it is!” everyone says. “Something something performance, something something MVC!”
Let’s take a look at some of the responses this question gets and see if they hold up:
Your styling should be done using CSS wherever possible—adam
This is a popular answer to the question. But it’s not an answer at all.
CSS is faster… JS tends to be slower.—serakfalcon
Doing what? On what hardware / OS?
No. No, it’s not common.
For me, there’s one reason: portability.
I’m presently working on three web projects: one in TypeScript, one in React, and one with jQuery. If I can design a UI with CSS alone, I can fly it into any project with ease.
Enter your email address and I'll email you the next one.
I'll never give away your email address or try to sell you something.
Send me an email anytime and I'll get back to you: firstname.lastname@example.org