Top
Best
New

Posted by mpweiher 20 hours ago

Moving away from Tailwind, and learning to structure my CSS(jvns.ca)
466 points | 300 commentspage 2
fps-hero 4 hours ago|
Tailwind isn't just a framework; it's a design system.

The creators of Tailwind wrote the brilliant book "Refactoring UI" [0], which presents a systematic design system, introducing ideas such a type-scales, color-scales, spacing, and tactics to minimizes the cognitive burden on the designer by forcing design choices. The ideas presented in this book basically are tailwind classes!

When you build with Tailwind, everyone is speaking the same design language, and you end up with harmonious designs, even when components came from different projects or designers.

I disagree with the author's approach. It's basically just copying the utility classes from Tailwind and implementing them in an unergonomic way. Perhaps the best idea is component level CSS which is something that's been enabled by better tooling. I would implore anyone who doesn't really get Tailwind, to read the origin story [1].

[0] https://refactoringui.com/ [1] https://adamwathan.me/css-utility-classes-and-separation-of-...

zdragnar 3 hours ago|
Both refactoring UI's ideas you mentioned and component css far predate tailwind.

Atomic CSS really solves problems that only exist if you're holding the tool wrong, in my humble hot take.

KolmogorovComp 15 hours ago||
For me Svelte and LLM completely removed my need for Tailwind. Turns out I was using it primarily to avoid CSS collision, and (to me) more logical syntax, rather than the self-imposed constraints.
esafak 14 hours ago|
Why did Svelte affect your stance towards Tailwind?
eximius 14 hours ago||
Presumably because you just put the styles in the component.
Strom 9 hours ago||
Yes and Svelte automatically namespaces them, so there's no collisions.
brokegrammer 5 hours ago||
Two great things about Tailwind:

- AI already have data about its classes in their training data - No conflicting styles

This means that AI doesn't need to reference any existing stylesheets when generating new styles, which is great for context management.

With custom CSS, you'll have AI read existing stylesheets because otherwise its going to write conflicting styles or rewrite stuff you already have. This can be a problem if you have large stylesheets that take too much space in AI memory.

wbadart 10 hours ago||
Great writeup!

Lately I've been enjoying Open Props[0]. It's a library of CSS props/ variables that helps structure a design system. I like it because it's CSS-first, so like OP experienced moving off TW, I've learned more CSS, and it works with the browser not against it. It also provides some sane defaults for anyone less interested in fiddling with precise cosmetics.

[0]: https://open-props.style/

ramijames 10 hours ago||
I'm so grateful that people are starting to see that Tailwind is insanity. Just write your class and your CSS as CSS. We don't need to pollute templates with endless hard to parse and reason about tailwind nonsense.
klaussilveira 12 hours ago||
It bothers me that SMACSS is from 2011 and was completely ignored. That was the sane way to write CSS. Been doing that for more than 10 years and never had issues redesigning large applications.

https://smacss.com/

srcreigh 10 hours ago|
That site is a portal back to 2011, wow. Thanks for sharing.
pjmlp 15 hours ago||
Tailwind crazy adoption is something that makes me happy to nowadays be doing mainly boring stuff in distributed cloud systems and agents, instead of WebUIs.
digitalblender 4 hours ago||
From an accessibility point of view and working on an accessibility audit, using tailwind and utility classes can be really difficult. Working with tools like Siteimprove, will ask if there are matching selectors for things that may be similar, and idm there aren't you may find yourself, looking at each page separately, with that component in it.
iovrthoughtthis 13 hours ago||
html encodes a tree of objects

css applies attributes to objects via graph queries

the queries are tightly coupled to the tree. you must work hard to avoid scatter gun edits now. it doesn't make much sense to have attributes stores in a separate location to their use

it would be like assigning all of your instances attributes using decorators

pauxel 9 hours ago|
The part I’d miss most from Tailwind is not having to invent semantic-ish names for every wrapper, row, card, inner-card, card-content, etc.
More comments...