Live data from Hacker News

Why Tailwind CSS Won

matt-rickard.com

71–80 of 559 posts

Re: Why Tailwind CSS Won

#72
post #58
post #49

Earlier quoted context omitted.

Now imagine that you want to change the border color to yellow. Would you rather change a single line of CSS, or every single link on all your pages?

ctrl+h Suppose we want to change just one link? Would it be better to make a new class with all the same attributes except the color and apply that to the specific link.

> ctrl+h

Brittle.

> Suppose we want to change just one link? Would it be better to make a new class with all the same attributes except the color and apply that to the specific link.

Why copy the attributes? Just override the one you want to change. You can even use style="…" if you're sure that it's just one link.

Re: Why Tailwind CSS Won

#73
post #49
post #24

Earlier quoted context omitted.

I can sum up what I like about Tailwind in the following code: ``` (in CSS) a.link { border: red; } a.link:hover { border: blue; } ``` ``` (in Tailwind) ``` It's much easier in Tailwind for me to see locally what's going on with that styling. If I lived in this code all the time, or I was good at structuring CSS, then maybe the first would be more appealing. But I'm a shit at CSS, it always turns into an unmaintainab…

Now imagine that you want to change the border color to yellow. Would you rather change a single line of CSS, or every single link on all your pages?

Hopefully your link will be a component, so you only need replace one line anyway.

Then again if your styles are abstracted to a component, your CSS framework is irrelevant!

Re: Why Tailwind CSS Won

#74
post #47

Earlier quoted context omitted.

> this almost never happens in practice …so let's solve that by making it completely never happen?

Let's not spend extra effort supporting a theoretical feature that won't actually happen.

It happens pretty often. I change the style of my websites this way all the time.

Re: Why Tailwind CSS Won

#76
post #11

I don't get Tailwind. In my book, CSS is here to facilitate the style of multiple webpages by modifying a set of rules, and classes are here to mutualise said rules. With Tailwind, it looks like you design by writing HTML, which is the opposite of what CSS aims at. So if you wish to change your design, you'll have to update multiple templates instead of one CSS rule. Every time I've had to work with Tailwind, it felt…

I agree with you. As a developer I like the separation of style and content. We also gain better readability when the code says " 199 " than a long list of tailwind classes. CSS styles are also more reusable across different web sites. I can to some degree see that you can increase re-usability when using shared React components, but then you just create technical debt for those who want to test other frameworks It s…

Can you explain something about why you prefer the separation of style and content? From my perspective all that it accomplished is making me modify two files (html template and CSS) instead of one.

Re: Why Tailwind CSS Won

#77
post #49
post #24

Earlier quoted context omitted.

I can sum up what I like about Tailwind in the following code: ``` (in CSS) a.link { border: red; } a.link:hover { border: blue; } ``` ``` (in Tailwind) ``` It's much easier in Tailwind for me to see locally what's going on with that styling. If I lived in this code all the time, or I was good at structuring CSS, then maybe the first would be more appealing. But I'm a shit at CSS, it always turns into an unmaintainab…

Now imagine that you want to change the border color to yellow. Would you rather change a single line of CSS, or every single link on all your pages?

If you work with components, you don't have this problem. If you don't work with components, good ol' search and replace and it's done.

Re: Why Tailwind CSS Won

#78
Those who appreciate local styling as opposed to global would likely enjoy the Locality of Behavior article by the author of HTMX.

Link: https://htmx.org/essays/locality-of-behaviour/

Discussion on HN: https://news.ycombinator.com/item?id=31454886

I personally find it easier to have information spelled out locally at the "call site".

Re: Why Tailwind CSS Won

#79
post #49

Earlier quoted context omitted.

Now imagine that you want to change the border color to yellow. Would you rather change a single line of CSS, or every single link on all your pages?

Hopefully your link will be a component, so you only need replace one line anyway. Then again if your styles are abstracted to a component, your CSS framework is irrelevant!

Why would you use a component for something that's already a built-in HTML element?

Re: Why Tailwind CSS Won

#80
post #77
post #49

Earlier quoted context omitted.

Now imagine that you want to change the border color to yellow. Would you rather change a single line of CSS, or every single link on all your pages?

If you work with components, you don't have this problem. If you don't work with components, good ol' search and replace and it's done.

If you work with components then why not just use CSS?
Post reply on HN