style=""
in true clown fashionLet me explain why I’ve been enjoying inline style=""
attributes over everything else and do realize that I have used all
relevant tech in the past, including Tailwind.
One: I don’t spend energy on naming classes (Tailwind solves this)
Two: I see the styles right on the element they apply to, and in turn, on the parent element(s) as well.
It’s so much easier to make a mental picture compared to having to 1) decipher class names, 2) keep them in memory, 3) keep the layout of the DOM nodes in memory, 4) map the class names to the DOM hierarchy — again, in memory, 5) make the mental picture, and 6) still manage to fail most of the time to then 7) just use the inspector to find out.
All this mental gymnastics… inline style attributes do away with all this.
Three: The lowered baseline reusability is more often than not a PLUS. I don’t have to worry about breaking shit on distant screens that I can’t see at the moment.
Four: I still get to use classes. I just open a
<style></style>
block and shove it at the end
of body - in true cowboy fashion. Best of both worlds. Browsers and
hardware have come so far, the performance worries of 2000s and 2010s
just don’t hold water anymore. At least, not with what I’m doing. I’m
avoiding JavaScript altogether (trigger alarm!), which is also making
things easier and faster.
Five: You see, I don’t have to unlearn
things I spent so much time with. On the contrary, the familiarity I’ve
accrued over decades with CSS is here for me to capitalize
on with inline style attributes. Not to be unlearned.
Not to have to constantly look up some Gatsby-powered,
JavaScript-infested plague of a library reference to tell me that
display: flex
is now really just flex
. Or God
forbid if I want to align some text to the center.
Fuck that noise.
Yes, it might perform poorly at the extreme end, but I’m not there nor am I likely to ever get there with what I’m doing.
To those who hold and circulate the opinion that because a technique is not maintainable at scale, it cannot ever be regarded as an option… this and similar false dichotomies prevalent in this ecosystem put me off.
Of all the CSS tech we had, inline style attributes to me are still king.