News for hackers. Stuff that matters.
Re:Why Tailwind CSS Won by keyle on Wednesday August 16, 2023 @06:43AM (#37145145)
Gray beard's 5c: Tailwind is a farce and a catastrophe.

It's as modern as the style parameter is, and it's as reusable as a moving a dirt pile from one corner to the next.

You're not learning anything valuable by learning Tailwind. Learn CSS, that will stick with you for the next 20 years.

It amuses me when a library is implemented 'with tailwind', which means it's totally useless to the people _not using tailwind_, and excruciating to clean up.

Go ahead, downvote me to hell, I'll see you in 5 years.

Re:Why Tailwind CSS Won by epolanski on Wednesday August 16, 2023 @07:25AM (#37145431)
+1.

Let's say things how they are: Tailwind is a small catastrophe from an implementation, performance and maintenance point of views.

It got few things quite well in being a more modern bootstrap, had a stellar marketing and it's color palettes are really well done and leagues above the default material ones.

...that being said...

Tailwind's biggest pro is that it allows people that _don't_ know css that much to style stuff more consistently and easily. But that's where it ends.

Sadly there's a lot of issues when it comes to maintenance. Any small update in tailwind will break your application. !important s are shoved pretty everywhere, they will unavoidably clash, prompt you to override even more styles.

There's yet another complication with tailwind: the moment you want to do something more complex with tailwind or that it clashes with its own styles/rules you're in a bad corner where you need to know bot advanced css AND tailwind.

Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @07:35AM (#37145507)
None of this mirrors my experience whatsoever. That’s “how things are” for me.

I know CSS very well and Tailwind is probably the largest productivity boost I’ve encountered since, I don’t know, learning vim? It’s way faster than SASS/SCSS which is itself way faster than raw CSS.

It also yields far more self-contained and more readily composable components than any other styling mechanism.

Your comment doesn’t resonate with my experience at all.

Re:Why Tailwind CSS Won by xtian on Wednesday August 16, 2023 @08:18AM (#37145898)
My experience mirrors yours 100%. What the parent comments seem to be describing are Tailwind in a context where people don’t know CSS that well. Yes, that will be a catastrophe. But so will SASS or vanilla CSS — even more so. Tailwind is a utility, not a replacement for fundamental knowledge.
Re:Why Tailwind CSS Won by epolanski on Wednesday August 16, 2023 @08:34AM (#37146100)
On the other hand, people that know CSS very well will not need suddenly tailwind to get some utility classes.
Re:Why Tailwind CSS Won by nucleardog on Wednesday August 16, 2023 @08:39AM (#37146162)
And people that know (Python|Ruby|PHP|Go|Etc) don't need the framework to implement a web app, yet we use them anyway.

What is the value of reimplementing a bunch of this if it already exists? What's the value of having every developer learn some poorly-documented in-house system when we can use one that's already out there with full documentation, examples, references on StackOverflow, etc?

Re:Why Tailwind CSS Won by broast on Wednesday August 16, 2023 @10:01AM (#37147141)
As a programmer that likes to paint, I think the difference is that web pages are a visually artistic medium. Artists that have unique fine detailed visions often feel the need to use low levels tools to perfectly achieve those visions. I guess this this applies more to individuals than teams however.
Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @08:44AM (#37146206)
There are tons of people who are perfectly proficient in CSS who are not won over to utility classes. As you become more won over, you start writing files full of utility classes that… wait for it… someone else has already written! With huge coverage over CSS! And really good defaults! And lots of escape hatches!

And to top it off, nothing guarantees your colleagues are actually going to use those instead of creating their own ad hoc “semantic CSS” or whatever their preference is.

If you decide you’re a utility-only frontend, then… there’s a great tool for that!

So now why on earth are you still plugging away at that utils.css?

Re:Why Tailwind CSS Won by dartos on Wednesday August 16, 2023 @09:31AM (#37146763)
“If you know <insert underlying technology> then you can just make <higher level, more productive technology>” isn’t a great take
Re:Why Tailwind CSS Won by danielvaughn on Wednesday August 16, 2023 @09:53AM (#37147017)
I've been writing CSS since 2009 and I love Tailwind. It allows me to very quickly build UI that has a consistent look and feel without having to stop and think.
Re:Why Tailwind CSS Won by xtian on Wednesday August 16, 2023 @10:56AM (#37148070)
Yeah, I wrote CSS without Tailwind for 15 years. I don’t need it. I’m just 10x more productive with it. If you don’t want to learn new things that’s fine.
Re:Why Tailwind CSS Won by simonsarris on Wednesday August 16, 2023 @08:24AM (#37145976)
This is where I wish we still have upvote numbers on HN. How many people agree with you vs parent and grandparent comment?

I've been doing web dev since I was a kid in mid 2000's and I think tailwind is phenomenal in enforcing style, portability, speed, etc. I recently started to writing a single .html file proof of concept for something and it was shocking how poor the experience is of `style="..."` is in comparison, or making up classes as you go.

Re:Why Tailwind CSS Won by epolanski on Wednesday August 16, 2023 @08:33AM (#37146092)
Utility classes aren't new to TW.
Re:Why Tailwind CSS Won by stanleydrew on Wednesday August 16, 2023 @09:22AM (#37146679)
Parent comment didn't claim they were new to TW.
Re:Why Tailwind CSS Won by nucleardog on Wednesday August 16, 2023 @08:35AM (#37146111)
Agreed. I've been using CSS for over two decades now. The composibility, reusability, and maintainability benefits of CSS have just never materialized outside of some very tight scopes such as toy projects or single developer projects as far as I've seen. And we pay heavy costs having half of the context of whatever we're working on living in an entirely separate file (any generally multiple discrete areas within that file or even multiple files) in a way that's poorly discoverable and debuggable.

Tailwind finally throws in the towel on all of that and just brings the full functionality of CSS to inline styles and leaves reusability up to whatever framework and templating you're using on top of HTML/CSS.

When I walk into a project using Tailwind I spend way more time actually working on _the project_ and way less time looking at the browser devtools trying to disentangle and chase down the complex web of interacting styles that are somehow working on the markup. Everything I need to know is already in front of my face directly attached to whatever element it's related to.

It is another thing to learn but it's pretty darn straightforward and well documented. Coming from a solid CSS background it took in the manner of hours before it clicked in my head and I was productive. And that largely translates to whatever project I'm digging in to instead of having to spend a bunch of time learning each project's bespoke styling system.

Tailwind is way less technically elegant than CSS, but the technical elegance of CSS has always seemed more lofty and academic than anything.

Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @08:40AM (#37146174)
This resonates quite well with my experience.

If you understand CSS well and you’re using TW, you will ~never have to go chase down some crazy style cascade via the inspector.

No amount of understanding CSS can save you from that in a complex CSS/SCSS codebase, because it’s how CSS is meant to be used.

Re:Why Tailwind CSS Won by nucleardog on Wednesday August 16, 2023 @08:54AM (#37146328)
Yeah it wasn't until I was reflecting and writing that comment that I realized _I don't remember the last time I had to look at CSS in the dev tools_ and how much better my life is for it.

Maybe I just suck at CSS. I mean, I've been using it for decades, but maybe I'm too stupid to actually understand it. And maybe it's the same story for everyone else I've ever worked with and that's why my experience with it has never lived up to the ideals.

... but if that's the case then at this stage of my career, with vast and varied accomplishments behind me, I think that says more about CSS than about me.

Re:Why Tailwind CSS Won by arrowsmith on Thursday August 17, 2023 @06:19AM (#37159543)
This, to me, is the best description in this thread of what I like about Tailwind and what makes it click for me. Well put.
Re:Why Tailwind CSS Won by jonwinstanley on Wednesday August 16, 2023 @08:36AM (#37146128)
I think I'm pretty good at CSS and have been using it for maybe 15 years.

I find tailwind just makes my life easier. Sure, it's not perfect, but I really don't enjoy giving every div and container it's own unique name and hoping none of the names ever clash with my colleagues unique names etc.

Also, I came to realise that websites never strictly follow the same design rules throughout. There are always exceptions. So you are constantly creating new style classes that are slight modifications of others. And keeping this all in your head is not easy.

I know a lot of people disagree and feel like tailwind is a problem, but for me I can just concentrate on making a great site rather than worrying about how a slight change to the styles inside .container might break some obscure part of my website.

Re:Why Tailwind CSS Won by throwaway154 on Wednesday August 16, 2023 @10:29AM (#37147605)
You don't need to give every div and container a unique ID. Why ever do that? Many things never need their own ID.

Are tons of divs and containers needed? When I find myself needing containers I usually find out I've not been thinking about arrangement very well.

Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @10:32AM (#37147655)
If the options are "never encounter a problem" versus "when I encounter a problem I realize that it's actually a superficial symptom of a more substantial problem someone made hours/days/weeks/months ago," I will take the former 100% of the time.
Re:Why Tailwind CSS Won by throwaway154 on Wednesday August 16, 2023 @11:07AM (#37148249)
Assigning an ID to every single element means never encountering a problem? I imagine that results in everything being a special case, much of the point of CSS missed, and in this special case Tailwind might even work as it's consistent with everything being a mess.
Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @11:19AM (#37148446)
Well it certainly means never encountering odd and complex style cascades, but Tailwind avoids that problem altogether without requiring IDs for everything.
Re:Why Tailwind CSS Won by martyfmelb on Wednesday August 16, 2023 @08:00AM (#37145720)
I think Tailwind could be made good for usage at enterprise scale, for example, as a customisable foundation for a branded design system.

If for example Figma offered first-class support for Tailwind-like utility classes in the form of a modernised "styles" or "composite tokens" feature, then mapping from a design system to Tailwind-based code could be pretty simple.

But right now, it's anything but. In my experience, designers simply aren't aware of the Tailwind structure, and it's hell trying to map their mental model onto Tailwind. Figma is built to design things that map easily to CSS at the attribute level, not the class level.

Re:Why Tailwind CSS Won by epolanski on Wednesday August 16, 2023 @08:39AM (#37146159)
How's any of that unique to Tailwind?
Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @10:23AM (#37147499)
"Burgers are delicious and greasy and salty"

"How is any of that unique to burgers? You should be eating tacos which are also delicious and greasy and salty."

Ummm okay...?

Elsewhere in the thread you're basically advocating for copy/pasting parts of Tailwind to get the benefits you care about in the moment, then I suppose copy/paste more of it when you run into another case it'd be useful for. One easy way to save time with that strategy is just to copy/paste all of Tailwind. Then if you're doing that, an easy way to save time is just run `yarn add tailwindcss`.

Re:Why Tailwind CSS Won by spion on Wednesday August 16, 2023 @08:04AM (#37145756)
One of the things that tailwind achieves is let you ship style in a way that is encapsulated within components and works reliably across any framework (including server-side rendering frameworks, react, svelte etc).
Re:Why Tailwind CSS Won by epolanski on Wednesday August 16, 2023 @08:37AM (#37146132)
That's not unique to tailwind.
Re:Why Tailwind CSS Won by nkohari on Wednesday August 16, 2023 @10:33AM (#37147667)
Does it need to be unique to be useful?
Re:Why Tailwind CSS Won by spion on Wednesday August 16, 2023 @11:55AM (#37149014)
What other approach gives you that?
Re:Why Tailwind CSS Won by JoeyJoJoJr on Wednesday August 16, 2023 @08:17AM (#37145885)
I was resistant to Tailwind for a long time, and recently I decided to try it on a recent project. IMO it lives up to its reputation and has changed the game for me.

The biggest pro for Tailwind is that it is exceptionally well designed. Aside from adding one single custom style to the Tailwind configuration, I have not needed to venture outside of the system it provides despite writing many bespoke components.

Re:Why Tailwind CSS Won by di4na on Wednesday August 16, 2023 @08:25AM (#37145988)
Could you explain the performance problem ? I understand how you could get to the other claims, even if i disagree.

But i sincerely do not understand the performance one. If anything tailwind approach is mostly really good for performance, as rendering utility class directly on the element is still the fastest, by far, technique.

The only slight call here could be shadow dom scoped but that necessitate declarative shadow dom and create a lot of problem for performance until we get a fetch maps equivalent to import maps.

What have I missed?

Re:Why Tailwind CSS Won by danielvaughn on Wednesday August 16, 2023 @09:16AM (#37146576)
You haven't missed anything. I swear, every time I read a thread on here about Tailwind I feel like I'm taking crazy pills. So far I've heard:

  1. Tailwind allows you to not learn CSS (not even remotely true)
  2. Tailwind is hard to move away from (what?!)
  3. Tailwind has performance issues (lol)
Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @10:22AM (#37147480)
something something 3rd party dependencies bad for (?) reasons
Re:Why Tailwind CSS Won by anyonecancode on Wednesday August 16, 2023 @09:16AM (#37146577)
>> Tailwind's biggest pro is that it allows people that _don't_ know css that much to style stuff more consistently and easily. But that's where it ends.

I'm considering advocating for a move to TW at work. Most of the devs _don't_ know CSS well enough to style stuff consistently and easily. We have very complicated cascades, and sibling style imports, and "semantic" class names.

Sure, maybe the answer is "level up your teams' CSS expertise." But I'm looking for something more pragmatic than that. I don't know if TW is ultimately the right tool I'm looking for, but the underlying ideas it uses are very appealing for this use case.

Re:Why Tailwind CSS Won by epolanski on Wednesday August 16, 2023 @11:22AM (#37148494)
Yeah it sounds like one of the cases where using tw could be good.
Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @01:25PM (#37150427)
Try Tailwind. I was a complete hater before I sat down and committed to one week project with it and I am frankly ashamed at how off my assessment was prior to using it.
Re:Why Tailwind CSS Won by deergomoo on Wednesday August 16, 2023 @03:39PM (#37152520)
> Tailwind's biggest pro is that it allows people that _don't_ know css that much to style stuff more consistently and easily

I have never understood this claim. You need a good understanding of CSS to use Tailwind effectively because it is CSS.

It’s not an alternative technology, it’s essentially just an alternative syntax—one that naturally leads away from footguns that many teams end up battling, like fragile CSS that everyone is scared to change.

You could just as easily define the utility classes yourself every time you need one, it’d just be a lot more work.

Re:Why Tailwind CSS Won by jongjong on Wednesday August 16, 2023 @07:38AM (#37145532)
Agree 100%. CSS is so good nowadays. Tailwind is yet another over-engineered hack of a framework foisted upon us. A solution looking for a problem.

You don't need it. Do devs these days even know about Web Components and shadow DOM? You can define per-component styles now with CSS selectors to target any child elements within the component and you can do it in such a way that the styles are contained within the component... And for cases where you want to inherit styles, you can just use the regular light DOM.

All these frameworks are re-inventing the wheel and making it worse. Or it's like attaching a horse to pull a perfectly good car.

Re:Why Tailwind CSS Won by dtagames on Wednesday August 16, 2023 @08:14AM (#37145852)
++ for mentioning web components and the shadow DOM. They are the end of the road for prepackaged frameworks, IMHO.
Re:Why Tailwind CSS Won by ng12 on Wednesday August 16, 2023 @11:06AM (#37148238)
Web components are a decade old, what do you think has changed or will change to make them more popular than frameworks?

I think unless there are massive improvements to the developer experience the best hope for web components is as an implementation detail for a higher-level framework.

Re:Why Tailwind CSS Won by dtagames on Wednesday August 16, 2023 @12:54PM (#37149923)
Good question. I probably should have qualified my statement. I can think of a lot of cases where an organization is better off building custom components on something like Lit (close to bare metal), rather than trying to shoehorn Angular or React into what you want. On the other hand, having a lot of predefined pieces and methods is also helpful to some people.

For me, I've been bitten and I would pick web components over a fixed framework for a clean sheet project. I don't think many devs have really tried to work with web components or they might get the bug, too!

PS: I wrote an intro series on this topic on Medium[0].

[0] https://medium.com/gitconnected/getting-started-with-web-com...

Re:Why Tailwind CSS Won by jongjong on Wednesday August 16, 2023 @07:07PM (#37155075)
I also think not many devs have tried to work with web components and that likely explains its current lack of popularity. Many mid-level devs are not even aware of its existence or they mistakenly think of it as some low-level tech meant only for framework engineers or deep system engineering type people.

That said, having taught some introductory web development courses in the past few years, I sense that new devs entering the industry are interested in simpler solutions and not particularly keen to get into React. The React learning curve is much steeper than it once was now that it has so meany features and the benefits are not so clear to someone who is starting from scratch.

Re:Why Tailwind CSS Won by ng12 on Wednesday August 16, 2023 @09:37AM (#37146803)
You're trying to sell me Web Components as a solution to over-engineered hacks?
Re:Why Tailwind CSS Won by randomdigitz on Wednesday August 16, 2023 @07:19AM (#37145376)
I’ve learned CSS, used Bootstrap, and tried a bunch of other tools. Tailwind ecosystem is the fast approach to building web UIs in my experience. It doesn’t matter if you know CSS or not. Nobody gains if you know CSS per se. People gain when you deliver finished projects. Tailwind helps ship projects faster.
Re:Why Tailwind CSS Won by progx on Wednesday August 16, 2023 @07:27AM (#37145447)
That is the point: which kind of projects?

You all fight, but nobody says what exactly they develop. A webpage and Tailwind is absolutely fun. An app with reusable complex components, Tailwind is a pain. Themes, dynamic tailwind is a pain, static, tailwind is ok.

There are endless possibilities. The problem is, that some people think you can use Tailwind for everything and then they made simple things unnecessary complicated.

Re:Why Tailwind CSS Won by whstl on Wednesday August 16, 2023 @08:15AM (#37145861)
I disagree 100% with that. I much prefer using Tailwind for complex apps with reusable components. Because then you don't have a lot of repetition, redundancy is as much as BEM.

For static webpages (unless it is assembled by a static blog engine or something), I don't particularly enjoy it, because of the repetition.

With components+Tailwind you have as much duplication as you'd have with pure BEM.

All personal experience and opinion, of course.

Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @09:24AM (#37146698)
I like tailwind but I only ever used it in a JSX context, if I had to author plain html I would likely never choose it.
Re:Why Tailwind CSS Won by openplatypus on Wednesday August 16, 2023 @08:32AM (#37146083)
Not my experience. We built a full rather complex and feature full application using Tailwind. How? Reusable components (we use Vue, but that’s just one option).

I remember this being endorsed approached by Tailwind creator.

No complaints.

Re:Why Tailwind CSS Won by nottorp on Wednesday August 16, 2023 @07:23AM (#37145407)
As a user of web sites, this attitude leads to me paying for your fast shipping in electricity for CPU usage, extra money for extra RAM, plus wear and tear on my nerves because you do what your library allows you to do instead of something usable.

Thank you.

Re:Why Tailwind CSS Won by ofcourseyoudo on Wednesday August 16, 2023 @07:36AM (#37145521)
Yes as we have seen through the years, pure CSS has resulted only in energy-efficient websites that are highly usable.

Slash

Ess

Re:Why Tailwind CSS Won by nottorp on Wednesday August 16, 2023 @08:04AM (#37145764)
If you don't know how the lower level layers under your current abstraction work, you end up on accidentally quadratic.

Am I more clear now?

Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @10:05AM (#37147209)
Do you know how Tailwind works? What you say is generally true, but I don't really see how it applies to TW...
Re:Why Tailwind CSS Won by nottorp on Wednesday August 16, 2023 @10:22AM (#37147484)
No of course I don't. And due to javascript's reputation, I assumed. Because what I said IS generally true for the js bubble.

The sad part is i don't even feel guilty for assuming, because this area of programming has a well deserved reputation.

Even if this thing doesn't use javascript, can you guarantee the generated CSS doesn't put the browser's layout engine in an infinite loop or something? Especially without knowing CSS, like the OP suggested it's normal?

Re:Why Tailwind CSS Won by ofcourseyoudo on Wednesday August 16, 2023 @11:16AM (#37148392)
>Am I more clear now?

Nope

Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @11:52AM (#37148970)
> can you guarantee the generated CSS doesn't put the browser's layout engine in an infinite loop or something?

the way TW aproximatively works is to collect a set of used class names from your code (e.g. flex, min-h-screen, bg-[url(/img/grid.svg)], absolute, etc.) and produce the CSS for those classes.

For the random 5 classes above it would produce:

    .absolute{
      position: absolute
    }

    .flex{
      display: flex
    }

    .min-h-screen{
      min-height: 100vh
    }

    .bg-\[url\(\/img\/grid\.svg\)\]{
      background-image: url(/img/grid.svg)
    }
By default TW also includes a CSS reset preamble and defines internal variables.

Sometimes the generated css contains complex selectors but as far as I know it is not a common occurrence

    .space-y-4 > :not([hidden]) ~ :not([hidden]){
      --tw-space-y-reverse: 0;
      margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
      margin-bottom: calc(1rem * var(--tw-space-y-reverse))
    }
In other cases more css variables (custom properties defined in the preamble) are used

    .-translate-y-1\/2{
      --tw-translate-y: -50%;
      transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
    }
    .shadow-xl{
      --tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
      --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);
      box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
    }
I believe that CSS performance is mostly dominated by size in bytes of the stylesheet, number of properties, complexity of selectors, and frequency of updates. I suspect that TW improves most of these metrics in exchange of bigger html class attributes.

https://play.tailwindcss.com/

Re:Why Tailwind CSS Won by scrollaway on Wednesday August 16, 2023 @07:50AM (#37145635)
Tailwind is not a performance hit, anyone who knows how it works knows that. Maybe stop throwing random accusations you can’t back up… it’s such low quality commenting.

Edit for the downvoters who don’t know how it works: there’s zero js being run at runtime, it’s a pure css framework that generates as-minimal-as-possible css files. And it’s not class lookups that cause whatever issues parent comment is talking about.

Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @09:31AM (#37146770)
Tailwind is not Styled Components, there is no dynamic component to it.

In that regard it is pretty similar to Sass.

The main effect on performance likely are bigger html documents (which can be optimized) and simpler CSS selectors.

In real world usage I would honestly guess that using simpler css selector (with far fewer propagating updates) is a net performance win.

(It was one of the showstopper for the :has pseudoclass, for a long time nobody knew of a way to implement it efficiently)

Re:Why Tailwind CSS Won by LocalPCGuy on Wednesday August 16, 2023 @01:25PM (#37150434)
Developers gain if they know CSS. Just like JavaScript - for either, if you understand the underlying base technology, it doesn't matter what framework you are presented with, you can learn the specifics of that framework fairly quickly, in my experience.
Re:Why Tailwind CSS Won by hising on Wednesday August 16, 2023 @07:37AM (#37145529)
Totally agree. Sometimes I feel old when having the same opinion.
Re:Why Tailwind CSS Won by ourmandave on Wednesday August 16, 2023 @07:02AM (#37145258)
You should really understand the CSS rules anyway (e.g. the C means cascading for a reason) so you can at least know what Tailwind is doing for you.
Re:Why Tailwind CSS Won by mouzogu on Wednesday August 16, 2023 @07:12AM (#37145326)
i agree but

ultimately what is cheap and fast wins. the future is someone else's problem.

i think that's a good description for javascript too.

Re:Why Tailwind CSS Won by SkyMarshal on Wednesday August 16, 2023 @09:16AM (#37146582)
It’s a good description for a lot of things, unfortunately.
Re:Why Tailwind CSS Won by nisegami on Wednesday August 16, 2023 @06:52AM (#37145199)
>You're not learning anything valuable by learning Tailwind. Learn CSS, that will stick with you for the next 20 years.

Tailwind maps onto CSS in a very straightforward way. I think you'd have to go out of your way to "learn Tailwind" without also improving your knowledge of CSS.

Re:Why Tailwind CSS Won by mablopoule on Wednesday August 16, 2023 @07:01AM (#37145252)
Except for the whole "Cascading" part.

I think I understand tailwind, but like the parent poster I'm really not a fan, because while CSS can be a footgun, it can also be quite clean when you use a sane DOM structure, CSS variables, and well thought out CSS selectors.

Re:Why Tailwind CSS Won by dikei on Wednesday August 16, 2023 @07:20AM (#37145385)
> it can also be quite clean when you use a sane DOM structure, CSS variables, and well thought out CSS selectors.

This fall apart pretty quickly as soon as more developers join the project. Keeping consistency between multiple team members is hard without a reference point, which is what a framework like Tailwind provides.

Re:Why Tailwind CSS Won by tmorton on Wednesday August 16, 2023 @07:09AM (#37145304)
There are many technologies that match this pattern: "While X can be a footgun, it can also be quite clean when you use A, B, and C."

In practice, they don't end up "quite clean" outside small personal projects.

Re:Why Tailwind CSS Won by paleite on Wednesday August 16, 2023 @07:06AM (#37145285)
i think that’s what people’s argument FOR tailwind is: CSS can easily be a footgun, unless everyone on the team uses a sane DOM structure, CSS variables and well thought out CSS selectors.

i’ve yet to witness a project without “!important” scattered throughout the codebase.

Re:Why Tailwind CSS Won by broast on Wednesday August 16, 2023 @07:13AM (#37145331)
That's sad to hear. Good CSS with an intuitive DOM structure is simple to achieve yet so powerful. Hate to see devs give up that power.
Re:Why Tailwind CSS Won by nisegami on Wednesday August 16, 2023 @07:32AM (#37145485)
Complex solutions are much, much easier than simple solutions.
Re:Why Tailwind CSS Won by yurishimo on Wednesday August 16, 2023 @08:19AM (#37145900)
Exactly this. Anyone who has worked with a junior developer understands this intuitively. They spend a week smashing their head against the desk figuring something out, then in review, you (the senior dev) can look at it for 30 seconds and see all the holes they missed and think of a simpler solution that uses 1/3 the amount of code.

Simplicity is a skill and it's hard to do. There's a reason most people are not minimalists despite the almost universal western desire to "have less stuff".

Re:Why Tailwind CSS Won by randomdigitz on Wednesday August 16, 2023 @07:21AM (#37145392)
Tailwind is a means to an end. If you think writing css is the best way to spend your time, go for it. But I guarantee I can ship things faster using Tailwind.
Re:Why Tailwind CSS Won by progx on Wednesday August 16, 2023 @07:29AM (#37145463)
Which things? Individual styled simple elements? Sure. Complex reusable and customizeable components, no way.
Re:Why Tailwind CSS Won by nisegami on Wednesday August 16, 2023 @07:35AM (#37145504)
>DOM structure, CSS variables, and well thought out CSS selectors

Since I graduated university, I haven't worked with anyone who I would trust to achieve one of these three things, let alone all 3. I don't think any of my ~10 coworkers even know what a CSS selector is (they may know how to use the basic three but don't know them as CSS selectors).

Re:Why Tailwind CSS Won by troupo on Wednesday August 16, 2023 @07:08AM (#37145297)
> quite clean when you use a sane DOM structure, CSS variables, and well thought out CSS selectors.

I've yet to see a single project that doesn't fail on all three.

Re:Why Tailwind CSS Won by mablopoule on Wednesday August 16, 2023 @07:34AM (#37145498)
I'm sadly not surprised to hear that, same for another poster who had the displeasure of working with a codebase with !important sprinkled everywhere.

Truth is I've been spoiled on that front because I had the luck to work for many year in a company where the CTO was a very talented dude who lived and breathed HTML/CSS since the mid-2000's, and who was quite thoughtful about that kind of stuff, so I had a first-hand experience of a good codebase, mostly by avoiding external dependencies, using the standard browser behavior, and frequently consulting the MDN.

This is why it's a bit disheartening to see so many front-end framework working against the plateform, even even marketing against it, while CSS and browser tooling his so much more enjoyable and powerful than before.

Re:Why Tailwind CSS Won by troupo on Wednesday August 16, 2023 @10:51AM (#37147984)
So, to have what you have you need a "very talented dude who lived and breathed CSS and HTML".

Technology that makes it easier to make bad decisions than good decisions is not a good technology.

> This is why it's a bit disheartening to see so many front-end framework working against the plateform, even even marketing against it

None of the frameworks I know of do that.

Re:Why Tailwind CSS Won by mablopoule on Wednesday August 16, 2023 @02:04PM (#37151086)
True, but the thing is that it wasn't really "complicated" CSS we used, but simply a good grasp on the fundamental of CSS, which is a overlooked part of web development.

I believe it's mostly due to the fact that CSS, just like SQL, is one of those technology approachable enough to fiddle with it and get somewhat far, while not really learning it, and thus overlooking the fundamentals.

> None of the frameworks I know of do that.

I would squarely put into this category all the CSS-in-JS frameworks, such as 'styled components'. Also everything that markets the 'cascading' part of CSS as being a mistake.

Also, all the frameworks that compiles CSS without generating the CSS sourcemaps, making the debugging experience way less efficient since all the applied CSS rules shows under '<style>' (eg: 'styled-components' again, who discarded it as being 'cosmetic' in the related Github issue).

Re:Why Tailwind CSS Won by marcosdumay on Wednesday August 16, 2023 @09:55AM (#37147058)
I'd say that the "stylesheets" part doesn't apply either.

Tailwind creates "stylesets", and is absolutely powerless to apply them. Quite like WYSIWYG text editors. So, yeah, anybody claiming you are learning CSS by using it doesn't really know CSS. But I disagree, that kind of thing can be useful on certain contexts.

Re:Why Tailwind CSS Won by troupo on Wednesday August 16, 2023 @07:07AM (#37145294)
> You're not learning anything valuable by learning Tailwind.

1. You need to know CSS to use Tailwind

2. I learned and understood quite a few of things I rarely use thanks to Tailwind's amazing docs. Docs that are non-existent for CSS

3. I'm reasonably good with CSS, but I could never come up with a consistent and minimal design system that Tailwind offers

That said, to things everyone should read to up their CSS game is Every Layout https://every-layout.dev/ and Inclusive Components https://book.inclusive-components.design/

Re:Why Tailwind CSS Won by thrixton on Wednesday August 16, 2023 @07:28AM (#37145455)
Having a prebuilt consistent design system that you don’t have to build out for each project, arguing over defaults among the team is a lifesaver.
Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @07:31AM (#37145478)
But you don't need Tailwind for that. A "designsystem.css" file with custom properties would do the trick. Without any added third party tech.
Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @07:37AM (#37145530)
Why should anyone care about adding third party tech?

This argument boils down to: “But you don’t need Tailwind for that. You can do more work for a (almost certainly) worse result with a designsystem.css!” Sure you can! Why?

Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @07:50AM (#37145642)
(Almost certainly) worse? Haha. Why would it be?

If you really want to, you can even use Tailwind's naming for you language file. The thing is, you add complexity to do a job that could be done in the same way without adding complexity and dependencies.

Shouldn't we try to justify added complexity through added value?

Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @08:00AM (#37145723)
> why would it be?

Because most frontend engineers cannot make something as visually appealing as Tailwind’s defaults and most designers cannot make frontend abstractions as ergonomic as Tailwind’s.

Now it seems like you’re suggesting just reimplementing Tailwind? Or yes you can have one of your FE engineers and one designer try to dream up your own Tailwind but again: why? Now you’re consuming two people for something that can be achieved by literally zero people and “yarn add tailwind.”

It is not at all my objective to “reduce complexity” that sits behind good abstractions. My goal is to ship product and to put as much complexity as possible behind good abstractions and ideally out of my team’s maintenance burden and Tailwind helps achieve all of those.

Sure, if Tailwind provided literally zero value I would say you shouldn’t add it to the codebase. But it provides a huge amount of time-value (the best kind!) in my experience, so “there’s a package from the internet” is hardly a consideration whatsoever.

Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @08:15AM (#37145865)
If the Tailind defaults are used in a design language file, wouldn't it be simpler? If it's only a problem of "aesthetics", 20 minutes is enough to use Tailwind's defaults in pure CSS. No need for calling a designer here either.

Side benefits include that there is then no need to update any dependencies or library, no need to run a JIT server, no need for a new syntax, no need to wait for implementation of new CSS features, better performance possibilities, etc.

Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @08:38AM (#37146144)
Just checking that I understand your suggestion: it’s that you copy/paste Tailwind into a file called “designsystem.css” and then say that you are not using Tailwind?

Or are you saying take their design system and use your own syntax for it (so it’s less complete than TW, less well-documented, and less transferable to/from the vast resources of the internet centered around TW)?

Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @08:49AM (#37146270)
I'm talking about the design aesthetics included in Tailwind as default. Keep the values and the names if you want. Like this, for example:

"blue-500" becomes --blue-500. That's it.

This is a far cry from using Tailwind as a whole while keeping the good-looking aesthetics.

Re:Why Tailwind CSS Won by troupo on Wednesday August 16, 2023 @10:14AM (#37147335)
> "blue-500" becomes --blue-500. That's it.

Of course it's not "it".

Now in every class that needs it, you also need to add

  {
    ... other styles...
    background-color: var(--blue-500);
  }
And then you need to apply that class
Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @04:04PM (#37152922)
How is that different than writing "bg-color-blue-500" in every component that needs it?

As for the class, it's the name of the component, the same name you give to the component file. Does it really add that much work?

Correct me if I'm wrong but as I see it, that's literally a couple of seconds of "work".

Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @10:28AM (#37147584)
Sure now do the same for: whitespace (margins and padding), border radiuses, shadows, opacities, font sizes, font weights, and continue playing whack-a-mole as you run into new cases.

Or just use the extremely complete, well-considered, well-defaulted, well-documented, well-supported, always-improving set of classes that took you zero hours of initial setup and will cost you zero hours of maintenance outside of your own use/application until the end of time. And it has a name so when a new engineer joins your team, you can say "we use Tailwind, go to tailwindcss.com" and they are fully read into your setup in about 15 seconds.

Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @04:48PM (#37153586)
mt-100 vs. margin-top: var(--100);

And the IDE will help you autocomplete it all. The same is true for all the other properties you enumerated. If it's a Tailwind design token, it can be a pure CSS design token. No "whack-a-mole" needed here.

Still, you're right about having documentation. And there has been a loooot of these kinds of doc (BEM, SMACSS, ITCSS, etc.) in the last 15 years. Nonetheless, a more modern-oriented one is indeed needed. And that's why I'm working on something like this.

As for the "15 seconds", I mean, really? If so, I beg to disagree. There is a lot to take in. And that is why numerous colleagues still have to open the Tailwind docs to know how to write a class that's not 1:1 CSS.

And lucky you if you haven't had any update and dependency issues in the medium to long term. But I know we had.

> Or just use the extremely complete, well-considered, well-defaulted, well-documented, well-supported, always-improving set "of CSS features".

The sentence above is every bit as true as yours. Add a beautiful design language and you are in business.

Re:Why Tailwind CSS Won by troupo on Wednesday August 16, 2023 @10:12AM (#37147310)
> 20 minutes is enough to use Tailwind's defaults in pure CSS

not 20 minutes, more. Plus all the boilerplate around @media rules

> no need to wait for implementation of new CSS features

What CSS features are you waiting for with Tailwind?

> better performance possibilities

It's very hard to beat Tailwind's performance since it's a fixed set of css classes (and a very small set in production, since it only includes classes you actually use".

Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @04:21PM (#37153182)
Boilerplate? What do you mean?

Any IDE can autocomplete 90% of any media query. And, on a sidenote, I was only talking about using Tailwind's default aesthetics in pure CSS, here. That's what the 20 minutes refers to. And I think it was a conservative estimate.

As for features, it took months before grid was included in Tailwind. New powerful and useful selectors aren't there. It took years for Tailwind to support "group hovers". And I can give even more examples if you're still not convinced. Or you can have a look at the changelog.

As for performance, can Tailwind split its compiled CSS so that only rules used in the displayed components are loaded? And that's not even considering the weight difference between the "tailwinded" HTML and the one needed to support pure CSS. These things matter if performance is a goal (as it should be).

If I'm missing something, go ahead and tell me, I'll be reading with great interest!

Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @04:58PM (#37153734)
What are you building where CSS and the "weight" of HTML is a real performance consideration?
Re:Why Tailwind CSS Won by emmacharp on Wednesday August 16, 2023 @05:31PM (#37154143)
Well, I'm building websites and apps.

And, as I'm sure you know, milliseconds are important in our craft. You can easily shave or add hundreds of milliseconds with HTML or CSS.

And to be honest, I find your general line of inquiry here to be quite agressive and dismissive. I think, respectfully, a little more good faith could further our understanding of each other.

Re:Why Tailwind CSS Won by ethanbond on Thursday August 17, 2023 @09:01AM (#37160907)
The question about what you're building such that you care about perf characteristics of CSS is an effort to understand you, I am sorry I failed to come across that way.

Outside of consumer apps I am struggling to imagine a case where the HTML/CSS perf delta would be more important to capture than faster development time. I suppose part of why that doesn't seem like a good faith question is because you don't believe Tailwind dev time to be faster, so the tradeoff that I'm trying to evaluate is totally inane.

Re:Why Tailwind CSS Won by emmacharp on Saturday August 19, 2023 @03:18PM (#37192132)
First, sorry for the response delay. I don't know why I didn't see your answer.

As for the case in point, in fact, I think CSS can be as fast if not faster. But that's totally for me to prove. Hehe.

That's why I'm working on a set of simple rules for efficient styling with CSS. A website with documentation, examples and tools is in the works. If you're interested, I can give you a heads up when it's online.

Feedback from Tailwind users is important and would absolutely be welcomed!

PS: thank you for the explanation.

Re:Why Tailwind CSS Won by troupo on Thursday August 17, 2023 @04:13AM (#37158628)
Boilerplate? What do you mean?

    :root {
      --gap-default: 2rem;
      --gap-large: 4rem;
    
      ... 30-40 more vars ...
    }
    
    .component1 {
      margin: var(--gap-default);
      padding: 0 var(--gap-large);
      ... more styles like this ...
    }
    
    @media (min-width: 640px) {
      .component1 {
        padding: 0 var(--gap-default);
      }
    }
    
    @media (min-width: 768px) {
      .component1 {
        ... other overrides
      }
    }
    
    /* potentially repeat for other breakpoints ...*/
    
    /* repeat for all components */
    
    /* repeat for some internals of some components */
There's a also a good (if contrived) example directly at Tailwind: https://tailwindcss.com/docs/utility-first

> As for features, it took months before grid was included in Tailwind. New powerful and useful selectors aren't there.

No one stops you from using whatever CSS you need alongside with Tailwind. I do that for the excellent layout breakout I found here: https://ryanmulligan.dev/blog/layout-breakouts/

Can't see how this makes Tailwind "ant-CSS".

> As for performance, can Tailwind split its compiled CSS so that only rules used in the displayed components are loaded?

Tradeoffs.

Most existing solutions can't even detect duplicated CSS. So if your existing component already has `width: var(--some-var)`, and you load a different component with the same style... You will still load that style hidden in a different (often auto-generated unique) class name.

Meanwhile with Tailwind has a fixed number of classes that apply to all components equally.

So, if you have a complex app with multiple component variations, of course you'll need to split your CSS and only load relevant CSS for displayed components. Because your CSS grows with the amount of variations, and each of those variations becomes its own unique class.

For Tailwind though that growth slows almost immediately because... it's just a fixed set of classes.

Re:Why Tailwind CSS Won by emmacharp on Thursday August 17, 2023 @05:51AM (#37159380)
Thanks for the great reply.

Here are my thoughts:

In your code example, all that is in :root should be used from project to project. As it is Tailwind. Only values should change. Again, same as Tailwind. So I don't really see a problem.

For .component1, you would do the same in Tailwind albeit with fewer characters but as I said, your IDE should pick up the slack here.

mb<tab> --gap<tab> and it is done.

As for your duplicate width problem, it can be solved easily with a linter that prevents styling across files. I'll give you an example if you're interested. At the same time, you would be repeating "width" across components in Tailwind too.

So the duplication still exists, if I understand correctly. Same with the growth of CSS... In Tailwind you grow the HTML instead. Fixed clases or not. I don't see how it is better but, again, maybe I'm missing something.

As for the media queries, same as above: your IDE should pick up the slack.

BUT!

The thing is that by writing modern CSS, you would not need most of these media queries! Do you know "clamp()[1]"? It's magical

And unfortunately not supported in Tailwind at the moment

.component1 { clamp(var(--gap-default), 1vw, var(--gap-large)) }

the above will do what you want without media queries! clamp() solves a loooot of these use cases. Honestly I don't write much media queries anymore and yes, that's great.

And if I may, I think Tailwind here prevents you from thinking about better and simpler solutions like this one. If it ain't included in what you're using, it's normal to not think about it. But really, this is a game changer. And it's been available for certainly three years. That's a lot.

And in the end, I'd say using real CSS with Tailwind kind of defeats the purpose. You end up with different styling methods for different components. I don't think that's good. More like a "hack".

But really, your example above is right on point: by excluding new approaches, Tailwind disincentivize you from using them when they would solve many of your problems elegantly and simply.

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/clamp

edit: the Tailwind example provided is bad CSS. As were the ones given in the first fundamental post by Mr Wathan. These are strawmen. If you're interested, I'll give you an example of good CSS producing the same output.

Re:Why Tailwind CSS Won by troupo on Wednesday August 16, 2023 @08:45AM (#37146210)
I tried to do that once. I decided to skip Tailwind and "just" bring in a few CSS variable that cover what I use.

By the 30th variable I stopped. The fact that I had to write significantly more boilerplate in CSS classes on top of that, helped me stop, too

Re:Why Tailwind CSS Won by epolanski on Wednesday August 16, 2023 @07:35AM (#37145505)
Care to show one simple example where tailwind's amazing docs cover something MDN or css tricks and others do not?
Re:Why Tailwind CSS Won by troupo on Wednesday August 16, 2023 @10:21AM (#37147454)
MDN's docs are amazing, but they are about everything. "CSS tricks" is not documentation (except some very helpful articles).

Meanwhile in Tailwind everything is grouped together, can be searched quickly and acts both as quick docs [1] and as quick reference [2].

I personally have become proficient with flexbox by playing with Tailwind classes.

[1] E.g. layouts https://tailwindcss.com/docs/display

[2] E.g. all the justify-content values https://tailwindcss.com/docs/justify-content

Re:Why Tailwind CSS Won by deprecative on Wednesday August 16, 2023 @07:28AM (#37145459)
If you know CSS why are you using Tailwind which is esoteric CSS but worse? Just use CSS.
Re:Why Tailwind CSS Won by ethanbond on Wednesday August 16, 2023 @07:39AM (#37145540)
Because it’s way, way faster to build with; yields more easily composable, less brittle components; and has a very solid (and rather unopinionated) design system baked in.
Re:Why Tailwind CSS Won by jongjong on Wednesday August 16, 2023 @07:46AM (#37145601)
So glad to read comments like this. I cannot believe my eyes that most devs these days just don't get it and litter their projects with layer upon layer upon layer of unnecessary complexity.

I thought a person had to be rational to become a developer but oh my, how wrong I was.

Re:Why Tailwind CSS Won by 3cats-in-a-coat on Wednesday August 16, 2023 @07:55AM (#37145682)
Everyone is a developer.

This is the paradox of popularity. The theory goes that if you have a large pool of X to select from, then you can select the best of the best, and the quality of your selection will be amazing.

But it's exactly the opposite. Small groups are self-selecting for quality and big groups are self-selecting for quantity. O_O

English, the universal international language. The one we're speaking here, right now. The worst translators in the world are English translators. Everyone feels qualified to speak it and translate it. Finding a good English translator is like looking for a needle in a haystack.

The more "easy languages" and "frameworks" we have, the more "programmers" we also have, and 99.999% of them have the faintest clue what they're doing, but they just keep hitting their keyboard with a hammer, and it compiles and produces interesting results, so they keep doing it.

This is also why social networks have an amazing set of interactions when they're new, and in an old social network you have hundreds of millions of users, but no one writes anything interesting, anyone barely reads, and it's full of scams, bots, clickbait and garbage.

There's safety in numbers, the saying goes. Not at all. If something is universally popular, and you choose to enter it, get ready for a shitstorm.

P.S.: Tailwind is garbage.

Re:Why Tailwind CSS Won by JoeyJoJoJr on Wednesday August 16, 2023 @08:24AM (#37145978)
Are there any resources like tailwindui or shadcn ui that are built on plain CSS, that are actually consistent and high quality?
Re:Why Tailwind CSS Won by 3cats-in-a-coat on Wednesday August 16, 2023 @07:48AM (#37145617)
You're not downvoted, which means... the tailwind... is turning.

I apologize.

Re:Why Tailwind CSS Won by Naomarik on Wednesday August 16, 2023 @07:53AM (#37145661)
Five years? How about now.

I saw a video a few months back featuring a VScode plugin to hide tailwind styles.

If you have to use a plugin to manage your nuclear waste code by hiding most of it something is wrong.

Re:Why Tailwind CSS Won by keyle on Wednesday August 16, 2023 @08:54AM (#37146321)
Re:Why Tailwind CSS Won by mmmeff on Wednesday August 16, 2023 @09:47AM (#37146934)
Tailwind advocates don’t maintain their code, they just hop between companies and leave the disaster behind for someone else to deal with.
Re:Why Tailwind CSS Won by nkohari on Wednesday August 16, 2023 @10:34AM (#37147684)
This is nonsense. You can't substantiate this, and you should avoid making such sweeping generalizations. It adds nothing to the conversation.
Re:Why Tailwind CSS Won by mmmeff on Thursday August 17, 2023 @12:46PM (#37164474)
Zealotry on display. How do you know I haven’t inherited a mess of tailwind before?
Re:Why Tailwind CSS Won by SkyMarshal on Wednesday August 16, 2023 @07:59AM (#37145708)
Are there any CSS frameworks you like instead? Or just raw CSS?
Re:Why Tailwind CSS Won by dtagames on Wednesday August 16, 2023 @08:12AM (#37145832)
I've been building websites since they were invented and I agree completely. CSS itself has evolved to the point where you are worse off if you use a pre-compiler or alternative.

In one sense, it was always worse to use Tailwind because if you don't learn "real" CSS you won't be able to fix anything that's broken -- and with CSS, there's always a lot that's broken.

Re:Why Tailwind CSS Won by meerita on Wednesday August 16, 2023 @08:16AM (#37145874)
The only thing that is true is people don't learn CSS but Tailwind syntax. But even with that, making a house of card of CSS isn't change the inherited problems of CSS.
Re:Why Tailwind CSS Won by onion2k on Wednesday August 16, 2023 @08:21AM (#37145937)
You're not learning anything valuable by learning Tailwind. Learn CSS, that will stick with you for the next 20 years.

You can't use Tailwind without knowing (quite a lot of) CSS. There's nothing in Tailwind that makes CSS easier or that obfuscates the technical understanding you need to make things with CSS. If you want to make a horizontal flexbox layout knowing "display: flex; flex-direction: row; flex-wrap: wrap;" or "flex flex-row flex-wrap" are functionally identical. You need to know what either the CSS or the Tailwind classes are doing to use them, and there's a one-to-one mapping between them. If you learn one then you know both. It's literally just a shorthand notation, or in a few places the equivalent of a macro.

I don't imagine Tailwind is going to last another 20 years, but I do believe that people will use 'utility first' CSS libraries like it from now on. No one is going back to writing plain CSS unless they have no choice. CSS is becoming increasingly capable, and with that increasing complicated. People choose Tailwind because it affords you all the power of CSS with a somewhat less arcane syntax. Why would anyone stop using that?

I do have a caveat though: I actually think Tailwind is the CSS equivalent of jQuery. In 5 years or so a browser is going to add a Tailwind style notation to its engine, and people will be able to use it without needing an external library. In that sense, yes, Tailwind will die, because browser developers will see the benefit is so significant that they'll adopt it as well.

Re:Why Tailwind CSS Won by weo3dev on Wednesday August 16, 2023 @10:33AM (#37147676)
Except when using Tailwind, you're learning Tailwind nomenclature and syntax and approach - which really isn't modern CSS, at all.

Today's CSS - if anyone would take the time to actually learn it as they do JavaScript - doesn't need something like Tailwind to make it powerful, scalable and manageable.

I write plain CSS today, which is then scoped to components or bundles of interactivity, and all of those point to major, top-level control sheets that help determine the mode (light/dark/high contrast) and the theme. We tweak small changes up high to effect large platform changes throughout, saving time, energy and headache of the hunt/peck exercise.

I don't understand the statement "no one is going back to writing plain CSS" because plain CSS today _is complex_. It is a beast. But it is still "plain" CSS. Yes, it has evolved, it has grown, and it meets today's modern needs with excellent results.

CSS nesting is coming up soon: https://caniuse.com/css-nesting That will more than likely allow me to migrate any projects I have with Sass still in play, to remove Sass. One more dependency removed. Done.

So there's really no need for Tailwind if you know how to build with modern CSS - with the one caveat that if a project _already_ has Tailwind in it, it is a bear to work with/alongside.

That to me is the biggest con with Tailwind: it gets in your way when you don't need it.

Re:Why Tailwind CSS Won by onion2k on Wednesday August 16, 2023 @11:04AM (#37148198)
I write plain CSS today, which is then scoped to components or bundles of interactivity, and all of those point to major, top-level control sheets that help determine the mode (light/dark/high contrast) and the theme. We tweak small changes up high to effect large platform changes throughout, saving time, energy and headache of the hunt/peck exercise.

I do similar things with Tailwind, making global changes by updating a config file instead of a base CSS file. It's not hard and it works well. To be honest, it's not something that really comes up very often. I don't see this as a particular advantage of Tailwind or CSS. I care much more about the day-to-day dev experience.

Prior to using Tailwind I spent about 20 years trying every system you can imagine to manage styles across large websites/apps. I still use the skills I learned when Tailwind doesn't cover an edge case I need. It's fine. Before that I spent about 5 years doing the same with tables and font tags (Adobe Pagemill was awesome). Of all the systems I've used, Tailwind is the easiest to keep neat and tidy. Maybe I'm a terrible dev and other people find CSS really easy to manage, but having spent two decades talking about it with other frontend engineers I'm reasonably certain that's not a common skill. Tailwind makes life much easier for most people.

Re:Why Tailwind CSS Won by andrei_says_ on Wednesday August 16, 2023 @06:21PM (#37154662)
One more thing I find baffling is the preference to ignore the cascade… and seeing it as a benefit.

The cascade is where the value of CSS comes from! It’s an incredibly powerful concept.

I use and love the Inverted Triangle CSS (ITCSS) approach and write a fraction of the CSS code I used to.

Having a few utility classes, using variables for project-specific colors, breakpoints, spacing, using fluid typography, grid, and flexbox, make writing well-structured minimal CSS code a pleasure.

https://www.xfive.co/blog/itcss-scalable-maintainable-css-ar...

https://utopia.fyi/

Re:Why Tailwind CSS Won by onion2k on Thursday August 17, 2023 @03:06AM (#37158214)
One more thing I find baffling is the preference to ignore the cascade… and seeing it as a benefit.

Tailwind styles cascade just like any other CSS rules. No one is ignoring it. The reason it might appear not to is because Tailwind uses layers (https://developer.mozilla.org/en-US/docs/Web/CSS/@layer). Technically it's a polyfill at the moment, but v4 will use the native @layer syntax.

If anything Tailwind is actually better at using the cascade than most plain CSS approaches.

Re:Why Tailwind CSS Won by blitz_skull on Wednesday August 16, 2023 @08:26AM (#37146010)
Cool hot-take but it’s not true. You’re literally learning CSS when you learn tailwind. And no one (good) picks up a tool solely because it’s shiny, they pick it up because they find it has utility, which evidently LOTS of people do.

And if you don’t think it’s reusable then you at least need to bring an argument for why that’s so because the docs, personal anecdote, and the opinion of LOTS of people is completely opposite.

So: - You ARE learning CSS, you’re just putting it where it belongs: on the element it affects - It’s modernity doesn’t matter at all - It’s literally as reusable as raw CSS

I can’t downvote you, but you’re definitely wrong.

Re:Why Tailwind CSS Won by yoav on Wednesday August 16, 2023 @08:58AM (#37146367)
Senior Staff grey beard: Counterpoint: The C in CSS stands for Cascading.

So you’re not learning CSS. You’re learning Tailwind specific classnames that expand to non-cascading style rules.

Re:Why Tailwind CSS Won by danielvaughn on Wednesday August 16, 2023 @09:12AM (#37146546)
This is not true. There's no way to create a "non-cascading style rule" unless the style rule already doesn't cascade. You still have to understand the cascade in order to use Tailwind.
Re:Why Tailwind CSS Won by kevlened on Wednesday August 16, 2023 @09:36AM (#37146791)
While it's true that there's no way to create a "non-cascading style rule", Tailwind allows you to mostly ignore the cascade (except for the normalization stylesheet), because everything is effectively an inline style.

That said, ignoring the cascade is a strength, because the first step in the cascade (css selector specificity) is remarkably complex [0], and can be a source of errors.

[0] https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

Re:Why Tailwind CSS Won by doix on Wednesday August 16, 2023 @09:31AM (#37146762)
> You still have to understand the cascade in order to use Tailwind.

Can you expand? I haven't used Tailwind, but from looking at the docs, it looks like a short-hand syntax for writing inline styles. Not exactly the same since it can take advantage of media queries and other things that you can't do with inline styles, but close enough conceptually.

Where is the cascade with Tailwind? Perhaps I completely misunderstood how it works, but I would say that it feels like it's purposefully trying kill cascading.

Re:Why Tailwind CSS Won by danielvaughn on Wednesday August 16, 2023 @09:48AM (#37146949)
There are two different things people could be referring to when they mention the "cascade".

One is CSS style inheritance. So if I do this:

  <div class="text-blue-500">
    <i>hello</i>
    <b>world</b>
  <div>
The `text-blue-500` style is going to cascade down to the descendent elements. That's just how CSS works and there's no getting around it.

The other usage of the term applies to a style of writing CSS that makes use of this cascade. So something like this:

  .card {
    color: darkgray;
  }

  .card .header {
    font-size: 20px;
  }
I think what people are referring to in this thread is the latter, which is not the cascade, but a particular approach to CSS.
Re:Why Tailwind CSS Won by doix on Wednesday August 16, 2023 @10:07AM (#37147238)
I mean, the top just happens because color has 'inherit' by default. The latter is specificity, and normally what I think of when I hear "cascading". But, it turns out that isn't cascading either [0].

Cascading refers to the order stylesheets have priority when loaded by the browser. Going to have to update my definitions for the future. I always thought cascading referred to how specificity worked.

Edit: no wait, specificity is part of cascading, cascading refers to the entire process of determining which style applies, including specificity. Inheritance on the other hand is not part of cascading. My definitions were right, don't need to relearn anything.

[0] https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade

Re:Why Tailwind CSS Won by gnagatomo on Wednesday August 16, 2023 @10:20AM (#37147440)
>But, it turns out that isn't cascading either

The order in which stylesheets are loaded and it's origin is just part of the cascading algorithm. See the "Cascading order" section https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade#cas...

Re:Why Tailwind CSS Won by danielvaughn on Wednesday August 16, 2023 @10:50AM (#37147968)
In truth everything mentioned above is part of the overall cascade. CSS takes almost everything into account - stylesheet ordering, rule ordering, rule specificity, etc.
Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @09:21AM (#37146658)
the cascade has as many benefits as it has drawbacks, few people like to juggle specificities.

IMHO the only important application of the cascade is in its original purpose: custom user defined stylesheets (today often via browser extension or adblockers), but you can add proper descriptive attributes to your markup for them.

Re:Why Tailwind CSS Won by weo3dev on Wednesday August 16, 2023 @10:18AM (#37147406)
In today's uses, cascade _with_ custom properties (the vars defined within :root ) are powerful and are what I leverage when providing theme-able ui libraries. Dark mode, light mode, large mode can all be solved using custom properties which to me most exemplify the power of the cascade.
Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @12:59PM (#37149994)
that is inheritance not the cascade: Inheritance allows for DOM nodes to use properties set on their ancestors, the cascade algorithm is how multiple conflicting rules interact and are overwritten.

https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_...

Custom properties are by default inherited by all descendant nodes (they also interact with the cascade, but it is less relevant) and this can be used with tailwind in a couple of different ways: https://stackoverflow.com/questions/64872861/how-to-use-css-...

Re:Why Tailwind CSS Won by iambateman on Wednesday August 16, 2023 @09:09AM (#37146499)
Mid level beard: Tailwind makes most sense in an app developed with components.

So the cascade still happens, just in a different way.

Re:Why Tailwind CSS Won by nkohari on Wednesday August 16, 2023 @10:32AM (#37147650)
Styles applied by Tailwind cascade like any other styles.
Re:Why Tailwind CSS Won by blitz_skull on Wednesday August 16, 2023 @03:19PM (#37152222)
You're not the first person to mention that, to which I counter: Cascading is a mistake in today's component-first web. It works at a very small scale, and _sure_ some things should be cascaded—which Tailwind absolutely lets you do. But 80% of your styles are going to end up scoped to their component—so you might as well use a tool that leverages that concept to its fullest extent.

All my "hard opinions" aside, I have anecdote that no amount of facts can change—I build things faster, more maintainably, that look BETTER than anything I did before Tailwind. Until those pillars stop being true—Tailwind will have my heart.

Re:Why Tailwind CSS Won by hinkley on Wednesday August 16, 2023 @09:27AM (#37146733)
> And no one (good) picks up a tool solely because it’s shiny

The amount of cargo culting going on right now is at an all time high. People do stuff all the time that makes no goddamned sense and is defended by, “well Google is doing it!” You are not Google and you never will be.

Re:Why Tailwind CSS Won by deltarholamda on Wednesday August 16, 2023 @09:55AM (#37147051)
>The amount of cargo culting going on right now is at an all time high.

In fairness, CSS is such a mishmash of things that it lends itself to cargo-culting.

You can fit the number of people who are exclusively CSS experts in a van and still have room for their luggage. Everybody else is going "that's cool, how do I do that?" and then copy/pasting it.

I mean, hell, it was years before you could reliably vertically center stuff with CSS (that we were doing with table-based layouts since the 90s). And considering the number of wonky layouts I've seen in what should be professionally done mobile Web sites, it's clear that it's hardly a Done Thing.

The nerd in me really likes SCSS, because I can more or less wrap my mind around it, but I get the Tailwind way as well. As a developer, CSS is way down my list of things to know intimately. Whatever I have to do to keep things moving, I'm good with it.

Re:Why Tailwind CSS Won by blitz_skull on Wednesday August 16, 2023 @03:12PM (#37152130)
Emphasis on "good". I don't classify developers who base their decisions on "Well Google is doing it" as "good".
Re:Why Tailwind CSS Won by weo3dev on Wednesday August 16, 2023 @10:15AM (#37147354)
I vehemently disagree. When you're using tailwind, you're learning Tailwind, which is using CSS in absolutely the unequivocally anti-CSS way.

CSS was meant to cascade; it's what the damn 'C' stands for, and if you cannot understand the efficiency of the cascade, at scale, you are most definitely missing the entire point of CSS.

I have personally built ui libraries for boutique firms and enterprise (Apple) firms and guess what we did _not_ use in any of those instances? Tailwind. Because it's an utter toddler to manage and very definitely not efficient in its application.

Re:Why Tailwind CSS Won by nkohari on Wednesday August 16, 2023 @10:30AM (#37147626)
There's a strong contingent of developers who would argue that the global-by-default aspect of CSS was a mistake. Hence nested selectors in Sass/SCSS, CSS modules, and so on.

Styles applied by Tailwind classes cascade. The library just makes it (intentionally) difficult to define a class that will easily collide with others.

Re:Why Tailwind CSS Won by blitz_skull on Wednesday August 16, 2023 @03:14PM (#37152160)
Actually, the "C" in CSS stands for "Mistake". Cascading styles are not a good idea, and Tailwind encourages using styles in a way that makes sense for a component-first web.

If you want to cascade all your styles all the way down, by all means go for it. However, I aim for readable / scalable styles rather than dogmatically "cascading" everything just because it's in the name.

Re:Why Tailwind CSS Won by gpspake on Wednesday August 16, 2023 @10:54AM (#37148031)
Yeah, I always describe tailwind as a lightweight classname-based abstraction over native css rules. It's a _good_ abstraction because it doesn't obfuscate the actual css rules; you're still wielding css when you use it. Colocating styles with components using short hand for css rules is brilliant and now that I've tasted it, I'm averse to our tradition of hiding things behind a bunch of subjective class names in a different file. Not too mention the optimization of removing unused styles based on the classnames used. Tailwind is good
Re:Why Tailwind CSS Won by greenie_beans on Wednesday August 16, 2023 @11:33AM (#37148677)
yeah i'm only able to use tailwind because i know the fundamentals of CSS
Re:Why Tailwind CSS Won by andrei_says_ on Wednesday August 16, 2023 @06:25PM (#37154705)
Most CSS codebases just like most JS codebases are low quality. This is a reflection of process more than anything else.

TailwindCSS puts a bottom threshold to the low quality - it guarantees a minimal level, regardless of what the rest of the codebase looks like.

This comes at the cost of general (but limited) messiness and guaranteed lack of maintainability.

I don’t use it but if I was on a team where engineers don’t talk to each other I probably would.

Re:Why Tailwind CSS Won by sibit on Wednesday August 16, 2023 @08:26AM (#37146015)
Tailwind 1.0 was great. Give me a few utility classes to style borders, fonts, backgrounds, and box shadows. Tailwind has descended into madness as they endlessly increase the scope.
Re:Why Tailwind CSS Won by mynegation on Wednesday August 16, 2023 @08:28AM (#37146039)
Me: Taylor Swift’s song are bland, run-of-the-mill pop. Swifties: Pfff *plonk gajillions for the tickets.

In cases like this I get curious and try to understand: why? I do not do CSS enough to arrive at the verdict about Tailwind, but my best understanding aligns pretty well with TFA. That and the fact that people wanted some framework that is popular and can be easily reused for results that look reasonably well. Bootstrap was it for a while, but Tailwind came and looked more modern.

Taylor Swift - still beats me.

Re:Why Tailwind CSS Won by naribe on Wednesday August 16, 2023 @08:32AM (#37146082)
I’ve studied and used CSS for 17 years. I’ve always enjoyed it and rarely complained. But tailwind is a joy to use and I prefer it over writing CSS.

There’s no replacement for understanding the underlying technologies of frameworks, that’s true. Compared to some frameworks, tailwind is only a small layer of abstraction, one that does not obfuscate the underlying tech away. It does not prevent you from learning or using CSS. That’s why it’s so good.

I frequently drop tailwind into projects because I know the shipped code footprint is low and it accelerates design.

Re:Why Tailwind CSS Won by bobmaxup on Wednesday August 16, 2023 @08:53AM (#37146315)
I think this always gets summarized as:

Tailwind is a pretty good framework for people who want to practice atomic CSS easily, and it is a bad framework for anyone trying to avoid that pattern.

The pros and cons of atomic CSS can then be argued about elsewhere.

https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...

Re:Why Tailwind CSS Won by petabytes on Wednesday August 16, 2023 @08:59AM (#37146385)
After a few years, writing CSS by hand gets really old. There's always 5 different ways to do something, and I don't know which one is the most performant or portable.
Re:Why Tailwind CSS Won by methodical on Wednesday August 16, 2023 @09:00AM (#37146392)
Bootstrap and its newer counterpart Tailwind have been around collectively longer than a decade, and I can't see any reason why their popularity would die down. It's easier to learn, quicker to write, and reduces a lot of issues that arise from poor CSS. I can see why some people aren't a fan, but those people seem (from my perspective) to be either luddites or people who misunderstand Tailwind. When you have people across the entire spectrum of experience who find writing styles faster with Tailwind, I can't understand how people find themselves on the opposite side of the argument without having some underlying bias or no practical experience utilizing Tailwind.
Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @09:01AM (#37146410)
Tailwind is made for a component world where reusability is at the template/component level.

This also covers both scoping issue with css: the usual issues with the single global namespace for classes and the unlimited depth of the descendant selector.

That is even with scoped classes if your app has component nesting as <A id=1><B id=2><A id=3></A></B></A> then a selector like .A_box::hover .A_btn will select the class A_btn both in <A id=1> and <A id=3>.

Tailwind solution is to manually or programmatically apply the relevant style in your template.

The whole idea being that the unit of reuse is not the class name but the templating component.

Re:Why Tailwind CSS Won by imbnwa on Wednesday August 16, 2023 @09:55AM (#37147055)
So do you do sibling selectors by using the array index in a `.map` call?
Re:Why Tailwind CSS Won by afiori on Wednesday August 16, 2023 @12:59PM (#37150002)
yes
Re:Why Tailwind CSS Won by LocalPCGuy on Wednesday August 16, 2023 @09:18AM (#37146618)
This has been my general opinion on Tailwinds all along. When it first came out I thought it was kinda harmless, it's basically like some of the utility classes that always inevitably get made/used and that's great.

But this idea that all styling should be done in HTML is antithetical to the whole reason CSS came to be in the first place, IMO. I can see why people like it to an extent, but I just don't really get the arguments that switching files to write CSS is "context switching" that makes things harder. If you need to see both your HTML and CSS at the same time then get a bigger monitor (mostly kidding).

I just still see that well crafted HTML and CSS work together, make sense, and especially with all the new tools available in CSS, just isn't that hard to get right. Well structured HTML is the biggest pain point I see for those that struggle against CSS. Learn that, the cascade, learn how to encapsulate styles (there are plenty of good patterns) and it will flow just fine.

Re:Why Tailwind CSS Won by LapsangGuzzler on Wednesday August 16, 2023 @09:55AM (#37147038)
I stayed away from Tailwind for the exact reasons you described until i joined a company that used it heavily and now I really see the value of it. I’m weary of new tools and cargo cult but Tailwind won me over.

It really shines for apps that are changing rapidly and are at risk for generating dead CSS, which has been a problem in pretty much every commercial codebase I’ve ever worked on. Tailwind adds a simple, straightforward, one-way-to-do-things approach that creates a much more maintainable experience in HTML templates that results in zero dead CSS code.

It’s absolutely not for people that need fine-tuned CSS APIs like animations, etc. But for building a product rapidly, it’s become a go-to for me.

Re:Why Tailwind CSS Won by LocalPCGuy on Wednesday August 16, 2023 @10:36AM (#37147718)
I get the challenge of dead CSS, I think there are strategies for managing that in complex apps without "ditching" CSS. And my understanding of Tailwinds is that it starts to break down for larger/complex apps also (but I've only used it on smaller things personally so that's just based on things I've read).

I never try to be dogmatic about new things - so I'd try it again. I just haven't seen the benefits yet myself and so default to the cons I expressed earlier.

Re:Why Tailwind CSS Won by LapsangGuzzler on Wednesday August 16, 2023 @10:55AM (#37148051)
> there are other strategies

True, but those usually involve adding some sort of linter to ensure that your style sheets are clean, which is an additional build step, which is an opportunity for a build to fail. Tailwind gives me this out of the box and doesn’t require any sort of manual lifting because it does this automatically.

> Tailwind starts to break down for larger/complex apps also

This hasn’t been the case for us, I’m on a team of about 50 devs contributing to a 2 year old monolith and Tailwind hasn’t once gotten in my way.

Re:Why Tailwind CSS Won by LocalPCGuy on Wednesday August 16, 2023 @01:20PM (#37150344)
Thanks for the data point re: larger apps. Like I said, haven't had that experience with Tailwinds specifically so I can only go by the various things I read about those who have. I'm sure it's like any other tool - it can be used or abused.
Re:Why Tailwind CSS Won by yencabulator on Wednesday August 16, 2023 @11:15AM (#37148384)
> at risk for generating dead CSS

For what it's worth, in SvelteKit CSS is per-component and you get warnings for unused CSS selectors.

Re:Why Tailwind CSS Won by CuriouslyC on Wednesday August 16, 2023 @10:02AM (#37147167)
Styles get stupid when they're not local, it just creates a huge hassle as projects scale. The only answer is a css file per component, or css embedded within the component directly. This css has to have a preprocessor or you won't be able to maintain a functional design system or any stylistic consistency. So you're stuck with sass/less/tailwind regardless.

Style classes are IMO the neatest way to inject styles, having elements get styles based on html structure makes code brittle and hard to reason about. If you need an example of this try playing with bootstrap forms.

Re:Why Tailwind CSS Won by nilslindemann on Wednesday August 16, 2023 @10:13AM (#37147319)
@layer has made all this much easier using raw CSS. One creates sensible global defaults in a `@default {...}` layer, and then they overwrite in a `@custom {...}` layer.
Re:Why Tailwind CSS Won by Spivak on Wednesday August 16, 2023 @10:44AM (#37147875)
Yep, the only even kinda maintainable CSS ends up being tailwind but in another file.

   <div class="unique-component-name">
      <input class="unique-component-name-input" />
      <p class="unique-component-name-text">Blah</p>
   </div>

   <div class="unique-component-name unique-component-name-variant1">
      ...

   .unique-component-name {
      ...
The cascading in HTML makes the thing that should be easy, creating variants with slight tweaks the most painful thing.
Re:Why Tailwind CSS Won by LocalPCGuy on Wednesday August 16, 2023 @12:58PM (#37149980)
I actually agree with most of your comment. Just not that Tailwinds is the best way to actually do the styling. I don't have any issue having some form of compilation/processor step that takes colocated CSS and creates a final output, that isn't my objection to Tailwinds, in case that wasn't clear in my original comment. I prefer to actually use CSS, most often via style classes.

And I did not say to base styles on html structure - you are correct, that is brittle and actually one of the things I often ask about in FE interviews as a way of determining skill level. I said that good html structure makes CSS much easier, if your structure is bad, it can significantly compound the amount of CSS needed in order to achieve the desired outcome. So I believe there is a significant distinction in those two statements.

Re:Why Tailwind CSS Won by ghc on Wednesday August 16, 2023 @09:36AM (#37146786)
I've been using CSS since 1997. CSS was basically a shit show for its first 20 years thanks to all the slightly differing browser implementations. I will tell you, that is what stuck with me.

Tailwind is a massive improvement in terms of maintainability across teams and tooling. Thanks to Tailwind my team hasn't had to think about CSS resets and browser shims for over 5 years now, and any bugs where an application looks different in a particular browser can be forwarded to a team who will fix it, instead of us having to maintain an ever-growing pile of special rules feature detection code.

There is, of course, no silver bullet, but for a team building applications from components with React or Vue, Tailwind is a maintainability dream compared to stylesheets, and easier to train new devs on too.

Re:Why Tailwind CSS Won by weo3dev on Wednesday August 16, 2023 @10:23AM (#37147496)
Except if you bundle your styling with the component, like you should be doing with React or Vue, and you have two _maybe_ three over-arching foundational style directives being implemented across your build, you do not need Tailwind.

I believe both React and Vue have the capability to scope your CSS along with the components. Modular CSS has been much easier to maintain over years than fixing when Tailwind updates or finding (again) that one !important that happens to conflict with a new released component set.

I save my teams time and money by applying CSS in the manner that it should be; which means not as an inline style mechanic.

Re:Why Tailwind CSS Won by ghc on Wednesday August 16, 2023 @10:41AM (#37147823)
> I believe both React and Vue have the capability to scope your CSS along with the components.

While that's true, it also means you need to propagate all of your exceptions for support of old browsers. And you still need a ton of global styles so your application can be re-themed or white-labeled according to your customer specifications. And god forbid someone applies a color directly in a component and you have to grep the codebase looking for the errant code.

After 5 years of tailwind on several complex applications, I can say that it's been easier to maintain, especially as engineers come and go, than any of the applications I worked on before. Frankly, every company I've ever worked for wound up with something like their own bespoke tailwind anyway, but instead of having it well-documented, every new hire had to learn whatever naming system whoever wrote the global design styles decided on.

Re:Why Tailwind CSS Won by lucasyvas on Wednesday August 16, 2023 @09:50AM (#37146981)
I would concur that all I mostly need is CSS modules and to know when styles should be copied (most of the time) or actual utilities (rare).

Any remaining reusability can be handled with templates / components (depends on your framework).

The remaining potentially nice thing about Tailwind is that it more naturally constrains your options/syntax with utilities - when working with designers, this is probably a good thing. As always, the hardest problem of development is finding technology that best establishes the social contract.

Re:Why Tailwind CSS Won by ppradhan on Wednesday August 16, 2023 @09:59AM (#37147110)
I have written more raw CSS than I have written Tailwind in my life. But I like the well thought out utility classes of Tailwind so much I only go raw when there is no option.

I also don't think about it too much and sleep well at night ;)

Re:Why Tailwind CSS Won by sinan95 on Wednesday August 16, 2023 @10:05AM (#37147206)
I wished you provided arguments instead of "trust me bro".
Re:Why Tailwind CSS Won by naasking on Wednesday August 16, 2023 @10:17AM (#37147401)
> It's as modern as the style parameter is, and it's as reusable as a moving a dirt pile from one corner to the next.

For most uses, the only thing really wrong with the style attribute is the lack of breakpoints for responsive layouts.

Re:Why Tailwind CSS Won by lyjackal on Wednesday August 16, 2023 @10:24AM (#37147509)
And pseudo selectors like hover, and animations. If these problems were solved in css style tags, I’m not really sure tailwind would have much to offer. It’s basically inline styles as class names
Re:Why Tailwind CSS Won by thomasmatecki on Wednesday August 16, 2023 @10:18AM (#37147413)
Web technologies like this take hold because they make producing something more attainable to a wider group of people. Who cares it they're "worse".

I'm a backend developer, who works mostly in python. I'm probably never going to learn CSS but I can produce a user interface that looks like I'm competent by copy-pasting tailwind divs. In 5 years, I'll hire someone who knows CSS to fix it. It'll be cheap because webflow and squarespace are allowing graphic designers to build websites, which is squeezing the demand for CSS as a skill.

Re:Why Tailwind CSS Won by appplication on Wednesday August 16, 2023 @10:43AM (#37147855)
I second this as a backend python dev. I’m adopting tailwind for my latest project because I don’t need to learn the intricacies of front end styling. I really care so very minimally about it, and respectfully do not think anyone is going to need to be CSS masters in 20 years. If there’s any area where LLMs show promise to write reasonably responsible code, it’s front end styling. And that is coming from a huge skeptic of LLMs.
Re:Why Tailwind CSS Won by JeremyNT on Wednesday August 16, 2023 @10:27AM (#37147563)
I'll take this anecdote and counter it with the success of Bootstrap. You could have been using it for an entire decade now. There's a robust ecosystem around it to this day.

Bootstrap's future is increasingly uncertain, of course, under Twitter/X. Tailwind as the "new bootstrap" makes a decent amount of sense.

These frameworks aren't an excuse to ignore and misunderstand the underlying technology. It's worth understanding CSS, but these abstractions can really speed up development time, especially if your job involves more than "front end development" (which is still true for many of us).

Re:Why Tailwind CSS Won by theodorejb on Wednesday August 16, 2023 @10:36AM (#37147721)
> Bootstrap's future is increasingly uncertain, of course, under Twitter/X.

What do you mean? Bootstrap has not been affiliated with Twitter for more than a decade.

Re:Why Tailwind CSS Won by JeremyNT on Wednesday August 16, 2023 @11:23AM (#37148501)
I honestly wasn't aware of this - even the official git org is still 'twbs' and I assumed it was still related.

I edited that part out, thanks for pointing it out.

Re:Why Tailwind CSS Won by cdelsolar on Wednesday August 16, 2023 @10:35AM (#37147711)
Even grayer beard's 5c (well, I'm still under 40, but still):

You could not pay me enough to learn CSS. Every time I have to debug CSS there go many valuable hours of my life. With an insane amount of trial and error and judicious use of Chrome's dev tools I can usually hack some garbage together, until the next time I have to figure out how to remove the background of a button.

In the literal 90s I was building fully-featured GUI programs by dragging and dropping buttons and text boxes and inputs onto windows with Visual Basic, and the window resized nicely. Thirty years later I have to do the same thing with gazillions of arcane style sheets. It's a disaster. How did it get this way?

Re:Why Tailwind CSS Won by cosmotic on Wednesday August 16, 2023 @10:55AM (#37148042)
> How did it get this way?

Users were enamored by custom drawn UIs, so designers started demanding custom drawn UIs instead of native widgets. Most users don't understand what they lost and now pawing at interfaces to discover how they work is the new norm.

Re:Why Tailwind CSS Won by pavel_lishin on Wednesday August 16, 2023 @10:55AM (#37148047)
Don't forget that every few years, some new styling standard comes out. Forget tables, everything is floating divs. Forget floating divs, it's flexbox now. Forget flexbox, we're using columns.
Re:Why Tailwind CSS Won by MR4D on Wednesday August 16, 2023 @10:57AM (#37148082)
> It's a disaster. How did it get this way?

It’s called “progress” apparently, and older gray beards complained about it when we reinvented the mainframe through the same methodology.

For all of the re-use that us computer folks talk about, we surely reinvent the wheel an awful lot. I’m guessing that we have some sort of stubborn creative streak that causes it all. That’s my excuse at least.

Re:Why Tailwind CSS Won by fpoling on Wednesday August 16, 2023 @10:58AM (#37148108)
There are plenty of web site builders that allow for a drag-and-drop construction. But people who use them are not programmers.

I.e. programming is not supposed to be easy. So if one sticks to it, the problem has to be hard at least from the management point of view.

Re:Why Tailwind CSS Won by stickfigure on Wednesday August 16, 2023 @11:58AM (#37149073)
I'm 50 and spent most of the 90s building Windows GUI apps. I think you misremember it. As a general rule dialogs (especially the ones built with dialog builders) were static with fixed pixels sizes; double the screen resolution and the dialogs were half-size. Layouts were extremely static; even Java AWT's primitive flow layouts were almost revolutionary by comparison to what was available in MFC et al.

Modern web design is a mess, yes, but it's vastly more sophisticated than what was available in the 90s and I would not choose to go back.

Re:Why Tailwind CSS Won by cageface on Wednesday August 16, 2023 @10:46AM (#37147895)
As expected this dumb take shows up in every tailwind thread. Almost always by people that haven’t actually tried it.

I was skeptical at first too but after building several large and successful sites with tailwind I’ll now choose it every time. It’s the only CSS method I’ve tried that doesn’t turn into a hot mess at scale.

This attitude has become a pretty useful anti signal when considering who I want to work with though.

Re:Why Tailwind CSS Won by manuelabeledo on Wednesday August 16, 2023 @11:03AM (#37148188)
In five years, there will be another framework that replaces this one, and still most people won't need to write CSS.
Re:Why Tailwind CSS Won by greenie_beans on Wednesday August 16, 2023 @11:32AM (#37148667)
i think it's a matter of taste and preference. your taste and preference is different than mine. we don't have to work on the same projects together.