Tailwind CSS vs. Pico CSS (2022)
edofic.com
edofic.com
But Tailwind is for building... anything. It's better to think of it as inline styles with syntactical sugar. Yes, this has historically been something to avoid. But as components become more common, it moves the DRY to the HTML level (rather than CSS classes).
It's not for everyone or everything, but I've loved it. There's a joke that the hardest part of CS is naming things, and this removes having to map classes and IDs across two different files.
Personally for me, the opinionated pico styles don't work because I'm usually building high density interfaces and pico has stuff that I'd consider good for marketing kind of sites, e.g., buttons with large text (I think you can override/add styles but if it comes to that you should reconsider this choice anyway).
Another advantage for tailwind is that I can use to style components from other frameworks to my liking, e.g., skeletonUI or bits-UI.
A common complaint with tailwind is the long class names. While true I think it's unavoidable due to the flexibility it provides. But that's not why it doesn't bother me: the names make sense (like you say) and they're composable, i.e., you can put together or parse these class names piecewise.
PS: I should add that this article is fair in the sense that it doesn't prescribe over another, just shows which is best for what.
The docs are decent enough to configure this.
This is also the key difference between conventional CSS classes and Tailwind - it acts less like a set of predetermined classes, and more like a DSL for directly writing CSS inline in the "class" attribute. The result is arguably less reasonable than directly writing CSS, but on the other hand, it's a lot less boilerplate.
In my experience, it really clicks if you write a lot of components, in which case you've already got a way to reuse your code, and so tailwind fits in really nicely with that. If you're mainly writing whole-page styling, then Tailwind usually results in a lot of repetition and doesn't produce much better results than writing everything in CSS in the first place.
The main benefit is what you aren’t doing: jumping between css files and html, naming class’s, trying to debug layers of cascading, wondering what other unrelated components will be impacted by a css rule change…
Colors aren’t a great example because those should be set as css variables (dark mode right?). Think about padding: how many layers of margin/padding on parent wrappers is making things look strange?
The best argument is just to try it though.
If you work in a highly componentized scenario that’s probably convenient. You don’t have to name things as you would if you were to keep a separate css ruleset and then tie it to the html elements via naming.
Very noisy compared to a disciplined, structured css though. But who has time for that.
Have to disagree it's a design system - it's basically a theme. Consistent colors, fonts, borders, spacing is handy for sure - but Tailwind is not a great option if you expect to drop it in and have building block components, etc without a lot of work.
Thinking of TW as inline styles is harmful imo, the specificity works differently and there are a number of things that TW offers that isn't possible inline. Plus inline just carries a stigma which helps people dunk unfairly on TW.
My stack these days is Flask + HTMX + Alpin.js + Pico.css and I write almost nothing but Python and HTML.
- wonderful integration with pydantic for serialization - background tasks - autogenerated swagger docs - dependency injection per-route
"in-place" is a stretch, you will have to change code, but I found it to be a very speedy task to migrate a codebase from flask to fastapi.
At this point I don't think anyone doing anything beyond a landing page is working without some sort of build process anymore.
Feels amazing.
Also, most of the time all you need is flexbox https://css-tricks.com/snippets/css/a-guide-to-flexbox/
I do mostly backend work, but have spent plenty of time fixing frontend stuff. I can usually make it work but I can't build CSS from the ground up in the way I would with a backend / database application.
They are two different techniques that can work together well. If I’d make any comparison, it’d be between pico and tailwind’s typography plugin specifically.
If you need a build no reason not to use tailwind imo.
t-shirt vs sweater car vs truck cat vs dog