logoalt Hacker News

ahussainyesterday at 1:30 AM3 repliesview on HN

People like tailwind because it feels like the correct abstraction. It helps you colocate layout and styling, thereby reducing cognitive load.

With CSS you have to add meaningless class names to your html (+remember them), learn complicated (+fragile) selectors, and memorise low level CSS styles.

With tailwind you just specify the styling you want. And if using React, the “cascading” piece is already taken care of.


Replies

zarzavatyesterday at 2:14 AM

The point of CSS is specifically to separate styling and semantics, so that they are not tightly coupled.

If you were writing a blog post you would want to be able to change the theme without going through every blog post you ever wrote, no?

If I'm writing a React component I don't want it tightly coupled to its cosmetic appearance for the same reason. Styling is imposed on elements, intrinsic styles are bad and work against reusability, that's why we all use resets is it not?

I do agree that the class name system doesn't scale but the solution is not to double down on coupling, but rather to double down on abstraction and find better ways to identify and select elements.

show 8 replies
krsdcblyesterday at 11:53 AM

disagree. Colocation seems great when authoring, but it comes at a big cost of downstream tech debt

there could be better ways to ease the burdon of naming things, while preserving cascade and the actual full features of CSS

Tailwind is a mirage, a shortcut to not having to do the important stuff by stacking wrappers on top of wrappers and redundancy

And the "fragile" part is exactly the same thing with tailwind, it all remains low specificity class names

show 1 reply
hdjrudniyesterday at 2:30 AM

Those are the same selling points as CSS-in-JSS libs like Styled Components. Or CSS Components.

Except your last point about "low-level CSS styles" which I'd argue is a weak point. You really should learn the underlying CSS to gain mastery of it.

Not arguing for one thing over another, just saying Tailwind really never had anything to offer me personally, but maybe if I wasn't already proficient in CSS and the other 2 options didn't exist it might hold some appeal for me.

show 3 replies