Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

59% Positive

Analyzed from 4400 words in the discussion.

Trending Topics

#css#tailwind#class#don#button#classes#color#code#components#need

Discussion (95 Comments)Read Original on HackerNews

9devabout 2 hours ago
This is such a bikeshedding debate. While you don't recommend it, projects with Tailwind work. Over years. You can onboard new developers to it, able to contribute productively immediately. Likewise, you can pick up work after months or years and don't have to remember or rediscover how your styling layer works.

The conventions and class names come really naturally fast, and you can always look it up. It's just not as a big of a problem people make it.

But the most ridiculous part of the article I found the cascade complaint:

  <p class="text-red-500 text-green-500">I am some text</p>
Yes, this does not work. Why should it?! There is not a single use case where this is a good idea! In classic CSS, you might want to override something based on modifier classes, but that is just not a thing with Tailwind! If you end up programmatically layering class names, you're looking at a code smell. Instead, you want to use attribute or state modifiers, like `aria-hidden:opacity-0`.
bko4 minutes ago
> If you end up programmatically layering class names, you're looking at a code smell.

Why wouldn't you? Suppose you have Button class with `btn btn-primary`. The Button accepts className override so you can do <Button className='btn-secondary'>. In this case you use tailwind-merge or clsx. Your Button implementation would be clsx('btn btn-primary', className), in which case right most class name prevails.

Other than that, I agree tailwind is great. It lets you keep things all in one place. Names aren't particularly difficult to memorize and reason about and autocomplete does a great job. Build utility classes or proper components to encapsulate the styling and you're fine. What benefit do I have going to a css file to review my button styling over the actual Button component?

SebastianKra12 minutes ago
I agree that all of this is bikeshedding, but the cascade complaint is actually real.

It's so common, that there is an expensive runtime package, `tailwind-merge`, that is used by default in the most popular component library.

zelphirkaltabout 2 hours ago
I wouldn't even write such a class name. It smells like bad styling and layouting already. A CSS class should convey some semantic meaning. I would name it after the thing that should be red or green, not "red"/"green". That doesn't tell me anything. Maybe its name could be something like "danger" or "active" or something. Also the 500 looks very sus. Responsive design is best when it avoids such hardcoded numbers and depends on its content and dynamic viewport width calculations, and perhaps a few minimum sizes, if necessary to decide when things float, wrap, shrink, grow, etc.

It's a red flag (ha).

francislavoieabout 1 hour ago
Absolutely not. Semantic classes are the wrong way to go. Your components (and their props API) are what encode the semantics. With Tailwind you never need to try to come up with a name for anything relating to style, you just use utility classes. It reduces cognitive load significantly.
marcus_cemesabout 2 hours ago
I can see this argument both ways. On the one hand, logically you'd expect the last assignment to take precedence, like the style attribute. On the other, conflicting styles don't make sense.

The random outcome, entirely dependent on the Tailwind generation internals, is the worst of all worlds though, it's just an unfortunate side-effect of relying on cascading sheets to drive atomic styles.

yurishimoabout 2 hours ago
It’s random sure, but it’s also reliably random. This is one of the few footguns that exist in tailwind and luckily it’s super easy to catch. The IDE plugins will give you a warning if you apply multiple classes that manipulate the same attribute and there is no reason you also can’t catch it in CI.

Is it ideal? I guess not, but there are a lot of weird gotchas and footguns in CSS too. Just because they’re in the language doesn’t make them magically more or less of a problem. For a similar weird mental shift, consider adding @starting-style and the native popover open attribute. All the good tutorials online have a warning about cascade order because as a human reading it, it can seem wrong or backwards.

Kevin Powell’s most recent video about animating display: none covers it if you want a concrete example.

boxedabout 1 hour ago
Projects with a single gigantic CSS file also work and you can onboard people etc. That's not an argument.
9dev38 minutes ago
they do work… for any value of work. I have been in the industry for a while, and I've never seen a project which doesn't slowly devolve into fights with the cascade over time - arbitrary abstraction layers, ad-hoc organization patterns, developer-specific conventions, inconsistent naming, and so on. All of this usually creeps in the more a project grows. At some point, someone adds postcss or scss or another preprocessor and starts splitting files, and then a whole new set of new, made-as-you-go conventions comes in: Files per component or per view? Or rather per architecture concern? Usually a mix of them. As files are split, the class naming gets even more inconsistent.

And at that point, onboarding a new developer always means wasted time on understanding this whole organically grown set of bespoke conventions, class names, patterns, hierarchies, and so on.

Tailwind does not really have this pattern of deterioration growing along both time and complexity, it stays consistent on both axes. So it's definitely an argument IMHO.

guessmynameabout 2 hours ago
The fact that “text-red-500 text-green-500” resolves by stylesheet source order rather than anything visible in the markup means the “locality of behavior” promise quietly breaks exactly when you compose components dynamically, which is why tailwind-merge exists at all, and needing a runtime dependency to answer “which of my two classes wins?” is a real design smell, not a bikeshed.
9devabout 1 hour ago
That is kind of my point, though—you don't need tailwind-merge, really. There are two cases it solves:

One, adding classes from the outside to an encapsulated component with its own, internal classes, to make sure the outside-applied classes take priority. Either use the !important modifier on them (`ms-auto!`), put the components into a container div with the classes for layout concerns, or even better: Figure out why you need to make styling changes to a component that cannot be expressed via props. I would generally recommend components to not have outside-element styling like margins in them anyway, which most often fights with positioning later.

Two, merging prop-derived styling with base styles - for example for a `size: 'sm'|'lg'` prop. It's tempting to just use tailwind-merge here:

  const classList = tailwindMerge(
    'p-4',
    size == 'sm' && 'p-2',
    size == 'lg' && 'p-6',
  );
But that isn't necessary at all: The better alternative would be to use data attributes for visual concerns and built-in or aria attributes for interaction states. There are almost always element attributes that can represent what you want to have correctly, and data- where there are not. Then, you can just add a class accordingly:

  <span 
    class="p-4 data-[size=sm]:p-2 data-[size=lg]:p-6 data-active:font-bold"
    data-size={size}
    data-active={active}
  />
And you'll end up with easier to maintain components that derive their styles from the CSS cascade alone.
francislavoie42 minutes ago
I would reach for class-variance-authority (aka cva) instead for stuff like a size prop, it declaratively solves that.
gf000about 2 hours ago
It's not true - agents will visibly struggle more with worse code bases. If anything, certain kind of maintainability matters more in this era, than before, because it is so much cheaper to just generate a huge amount of low quality code.
pixardabout 2 hours ago
I see you have a .button, cool! So did you load the entire context of your project into your mind, and calculate every possible iteration of kind, size, color etc this button may have? And once you did that, did you come up with a semantically correct naming scheme that is clear and will not succumb to the inevitable .button_checkout_special_page_cta_widget a particular page will end up requiring?

No? Neither did I. I stopped thinking about CSS entirely almost a decade ago. Thanks Tailwind.

afavourabout 1 hour ago
It’s funny, as someone that’s been using CSS for decades I don’t really know how to respond because the scenario outlined here is not one I recognise. My button would be a <button>, so no, I wouldn’t have a .button class, it’s superfluous.

What I would have is:

- a global palette specified via CSS variables

- overrides for dark mode etc specified at the global level so I don’t have to worry about it at the component level

- CSS module files so I specifically don’t need to care for the context of my entire project, just the classes for my current component

Of course, you stopped thinking about CSS a decade ago so you don’t know about any of these improvements. Which is fine but it strikes me as a little strange to be so boastful of ignorance.

As someone who has barely touched Tailwind I’m genuinely curious: if you wanted, say, a consistent border color for use across your project how would you? Are you defining a class name in JS for use with $framework_name? And do you really style each component separately for dark mode? Repeating the same modifiers over and over?

Aeolosabout 1 hour ago
You just make a design system in your tailwind.css, following the documentation. You can optionally use something like daisyui if you do not have designer skills or the time.

That handles consistent sizing, spacing, text, colors, dark mode, and anything else your design system needs. It all compiles down to css in the end, so no runtime overhead and gives you the superior tailwind dx during development.

throwaway9an1zxabout 1 hour ago
Almost none of that is specific to Tailwind though, you can take any design system in CSS with or without JS and make the same argument right?
SebastianKra24 minutes ago
Are you suggesting to style the tag name directly? Because that would create chaos in a codebase. <button> is for semantics. It's possible that other design system components need the same semantic element.
afavour10 minutes ago
No, I’m suggesting that .button.something-else wouldn’t make any sense. You’d just do button.something-else… not that it would really be that useful to do so.

And as you say, it’s for semantics so I wouldn’t use .button anyway as it doesn’t carry the right specificity for styling.

Gigachadabout 2 hours ago
I feel like scoped css and component libraries fixed this issue. I don’t have a .button, I just have a <Button> that has all its css self contained.

And just a shared color definition file.

KolmogorovCompabout 2 hours ago
Same, my need for tailwind got completely ridden when I started using Svelte, thanks to the CSS-scoping it entailed.
michaelchisariabout 2 hours ago
And @scope does this for all of css.
dkerstenabout 2 hours ago
You still have to remember what sizes or whatever to use for what to make it consistent, it’s just they get packed into the “class” attribute. It’s not uncommon to see very long class attribute lines with tailwind with all kinds of p-this and mx-that or whatever. I’ve also seen quite a lot of p-[whatever] tags, at which point all the consistency goes out the window.

So you end up wrapping the components (if you’re using react or something similar) so that you can centralise the styles and use a set of consistent components instead. And at that point it really doesn’t matter if you use tailwind, custom classes, per component css modules, style attributes, css-in-js, or what have you. At this point I prefer to drop the extra dependency and use per-component css files with css module imports. (Or when I do less custom styled UI’s, I prefer to use Mantine and use its attributes for layout and styling)

altern8about 2 hours ago
Yes. Bootstrap and all other CSS frameworks before Tailwind did it, too.

It's a matter of preference, but many times it's easier to have single classes so that all your buttons are consistent.

People should just use the tool they're more productive with.

zelphirkaltabout 2 hours ago
I know what you mean. But somehow that doesn't bother me. In fact it forces me to think about consistency of the design and often makes me think of a more general schema and simplifications in styling, or getting rid of something too specific/special.
throwaway9an1zxabout 1 hour ago
Don’t you need to keep more context in your mind if you use Tailwaind to make .button_checkout_special_page_cta_widget while staying somewhat consistent?

Could you give us a few examples with and without Tailwind, including CSS variable and compose in preprocessors?

megousabout 1 hour ago
Yes.

you just add `checkout` class or `big` class to your button. or use `.checkout-page .button` to modify look/size of your whatever button on the checkout page if it's style is truly unique and not used anywhere else.

kolmeabout 1 hour ago
What? I don't even know what you're talking about, and I've written mountains of vanilla CSS code in big projects.
herrkaninabout 2 hours ago
I was very much in the Tailwind camp, and simultaneously loved it for its local reasoning and disliked it for how its long class names messed up my components. It has always felt like a bolted-on hack to me but I couldn't argue with the benefits.

Turns out, CSS Modules comes with the same benefits while feeling much more like a natural extension to the web platform. The only thing I thoroughly miss is functions and directives, which hopefully will land in browsers through the mixins proposal in not too long of a time.

grsmvgabout 2 hours ago
As a 26+ year frontender, years ago I was against it on so many levels. Until I tried it.

Never looked back. Also, inheriting projects with someone else’s code is fine. Just a quick look at the central config and you’re good to go.

arnejenssenabout 2 hours ago
Tailwind looks bad on "paper". It violates a lot of "best practices". It is ugly. Yet in reality it works. It gets the job done. It is fast to work with.

Constraints are known to enhance creativity.

seanclayton40 minutes ago
My constraint is "use vanilla CSS" ;) I made a huge solo project in tailwind. Never again. Vanilla CSS is perfectly fine for my own uses. In fact, I've gone a whole 'no classes' style and used as much semantic HTML and modern CSS and can get extremely far. No more looking into the tailwind docs to learn its syntax on a modern vanilla CSS feature that I've been waiting for.
Maxionabout 2 hours ago
IMO this is one of those things where theory meets practice. Theoretical coders (i.e. those who love the code itself, rather than how well it works for the end user) tend to hate on Tailwind, while those who prioritize end user value over code perfection tend to like Tailwind.
dist-epochabout 1 hour ago
Semantic CSS is Java AbstractBeanFactoryBuilder. Or as Steve Yegge put it, Kingdom of Nouns.

Tailwind CSS is Python dictionaries where you don't create one user-order-deliver-date CSS class for every Noun you have.

jonwinstanley44 minutes ago
Totally agree. It does break the rules, but it feels so much faster than defining class names.

On simple projects I usually @apply tailwind styles to standard elements like headings, block quote, aside, nav etc. Then just use semantic html.

Looks good and takes so little effort.

ejoebstlabout 2 hours ago
100% this. It looks terrible until you try it and it starts making so much sense.

Also works great with agent assisted development.

tibastral2about 2 hours ago
What is funny with your article is that you talk about tradition, when actually these traditions are based on assumptions which are themselves based on beliefs like : "separation of structure and style are a good thing".

But this belief is only true if the language to describe the structure is html or js which creates not reusable pieces of style/structure.

But when you go for a different approach where everything is functions and strong types (ADT), like when you use haskell for exemple, this debate is over, because you handle EVERYTHING in your code, and stop fragmenting the truth into opaque and dissociated worlds (html, js, css, database, glue, docker, ...).

tibastral2about 1 hour ago
I don't recommend css. Css is BLOATED. And tailwind makes it a little less bloated, but it's still not strongly typed, and not very re-usable, especially in code.

But your approach is from the past man, really... .btn is not reusable among pages / projects / etc. => it's always different, and when you understand that specificity wars is the main problem of css, you will not want to use your idea again.

It LOOKS cool to have a <button class="btn"> inside your html. because it's more readable. But it's NOT explicit. You fragment truth into different pieces. and it makes it IMPOSSIBLE to test things in isolation.

One last thing. Using all the "last features" of css is just putting you in a place where you depend on the browser carriers to handle things for you when I prefer personnaly to rely on myself and my craft. But that's a personal one ;)

baxtr30 minutes ago
I think this is a protypical discussion in tech. I have seen it soo many times in different areas.

The purists ("that’s how things ought to be!") and the pragmatists ("well but it works well and people understand it seemingly").

francislavoieabout 2 hours ago
Saying "unless you use @apply" invalidates this article for me. Everyone knows that @apply only exists as an escape hatch, it is not supposed to be used, except for when it's necessary like for compatibility with libraries that declare their own classes that you need to override.

The most commonly repeated point in the article is "escape hatches bad" and I think that's completely absurd. Of course you want escape hatches, otherwise when you do hit an edgecase you get stuck with no solution. That's exactly what would force you to throw away that approach and pivot. Tailwind doesn't have that problem because it was designed to include escape hatches.

Users deciding to use those escape hatches instead of sticking to a design, isn't Tailwind's fault.

nextaccounticabout 1 hour ago
It makes no sense for me that @apply is frowned upon. It's what makes Tailwind actually kinda usable for me. Without it, markup looks like line noise full of boilerplate that's hard to modify in a systematic way.

I think what Tailwind actually needs is more abstractions, not to discourage the use of the sole abstraction @apply

francislavoieabout 1 hour ago
Using @apply defeats the entire purpose of Tailwind. The point of it is to localize styling alongside the markup. If you're using @apply then you're constantly context switching from your markup to your CSS files while working.

There's plenty of ways to manage the bevy of classes you need. First step is making use of components to deduplicate stuff. Then in those components, use a library like class-variance-authority aka "cva()" which allows you to set up complex named presets for your components (like size="small" or color="primary" and things like that).

woutr_be25 minutes ago
I use @apply in quite a few projects, mainly because I like the defaults in tailwindcss. I know it defeats the point of tailwind, but I find that it works nicely when using BEM.
maelitoabout 1 hour ago
What's so strange with Tailwind users is how insistent they are to impose it to codebases they don't know. I've never seen this even with vue vs react.

People that didn't write lines of code on this project, or so.

A few months later, your codebase has very long lines of HTML with classes that encode a whole programming language as strings separated by spaces, and barely no component anymore, nor semantic CSS tags.

francislavoie37 minutes ago
Your complaint is about bad developers, not about Tailwind. Using Tailwind correctly means making heavy use of components to avoid duplication. Using Tailwind also removes the burden of having to do one of the hardest things in software: naming things, which is what semantic classes requires you to do.
eugene3306about 2 hours ago
I tried to use Tailwind in a hobby project couple years ago. I havn't updated my CSS skills since 2010 or 2015 -- I certainly missed grid layout and some other new features.

Quickly, I realized Tailwind is documented on top on CSS, no way around. This makes you keep in mind both.

No idea why is Tailwind even a thing.

ckdotabout 2 hours ago
Show me one non-trivial project with classic, well-organized CSS usage and clean semantic HTML. It just never works out. There were attempts like BEM, which looks promising at first sight but is awkward at some points and only works if all devs strictly follow the convention. We all know how this usually works out. I once was that semantic HTML and css classes guy too, I completely changed my mind. In the end, we want to efficiently build a clean and shiny website. No real user looks into the (unminified) HTML source code to appreciate those awesome, sophisticated semantic CSS classes.
efortisabout 2 hours ago
CSS Modules are a better solution. They compile classnames into unique identifiers, so there's no need for BEM or SMACSS conventions:

https://x.com/efortis/status/1888304658080256099

francislavoie33 minutes ago
I disagree. I don't want to jump between two files constantly. With Tailwind I can stick to one file and never need to think about naming things.
parastiabout 2 hours ago
This is written from a point of view of somebody who never went through the progression of CSS to CSS preprocessors to component-based frontend libraries. Tailwind is an answer to all the problems that become apparent in CSS in that progression.
Advertisement
emsimotabout 2 hours ago
I'd appreciate a way to disable the real-time chat on this website, I don't see a way on mobile. It's currently full of racial slurs.
noduermeabout 2 hours ago
God help me, somewhere around 2016 I started using some alpha version of Bootstrap 4, and I just keep using that same version for all the basic stuff underneath my own SCSS for whatever I'm building. It's absolutely fine. A lot of it is displaced now by grids, but for flexbox stuff and modals and pushing rows and columns it just works. Very easy to remember class names and extend it. Thankfully I don't work for a company that cares about using the latest thing.

The only really critical things I need in scss are scaling typography and variables representing colors for iteratively generating class names and gradients and transparencies and stuff like that. By "scaling typography" I mean, I just have a loop that writes .scaling-typography-[a]-[b] where a and b range from 1 to 16, and the class that's generated scales from [a]em to [b]em between a phone size and a desktop size. In a rare case where that doesn't just work or it doesn't look good on a tablet or something, a couple specific rules extending xs- or sm- or whatever will cover it.

zandertabout 2 hours ago
Strongly disagree with the point of not learning CSS. Bootstrap and the sorts that were en vogue before were terrible abstractions.

All the mental models required to be good at writing proper stylesheets are trained nicely with Tailwind

sureglymopabout 2 hours ago
My (certainly not unique) take is: As with almost everything, choose what you use based on context. There is a very wide range of websites and web applications you can make. For some of those tailwind is a good fit. For many it is not.

For my own projects, I have been perfectly fine with just one large global CSS file, extending it just when I have to. But I could this being maybe tedious when working in a large team.

monkeyislandabout 2 hours ago
I've used a lot of tailwind professionally over the last few years and I agree with this article - it is spot on.

I never even use tailwind in my own stuff, even though I think that small devoper-led side-projects are where it is a good fit (and the reason for it's popularity).

yurishimoabout 2 hours ago
I have the opposite experience regarding where it’s useful. In large teams , using an atomic css framework provides good guard rails and predictable behavior. I can confidently copy a marketing page or some random thing on the other side of the company and with very minimal tweaking, it will probably work. With normal CSS, the cascade is much more likely to cause subtle shifts in behavior over time as the main stylesheet is extended and modified.

To be clear, I like css and I find the cascade a great tool, but I also have first hand experienced the pain of too many chefs in the frontend styling kitchen and the havoc that seemingly innocent tweaks here or there can wreak on a site and I prefer tailwind for that reason.

qsortabout 2 hours ago
I'm not a frontend guy so take this with a pinch of salt, but for a few personal projects I've done my approach is now "ai pls generate css". I thought it would be inconsistent and broken, but if you tell it to care about accessibility and you're willing to clean up a bit it's not that bad and you end up with very compact transfers after minification.

I tend to like simpler/textual interfaces though, admittedly this won't be everyone's cup of tea.

gherkinnn40 minutes ago
This discussion again. We've been having it for 6 years now and Tailwind remains popular. Lindy's Law tells us it will remain popular for a while longer.

Many people are productive in it, others hate it. Carry on.

elendilmabout 2 hours ago
Coming from Qml, reading css/html is mind numbingly hard.. Haven't seen any other come even remotely close to the readability of Qml. I am talking generic UI development, not just for browsers.

15 years and I thought someone would have by now the neat syntax that Qml has.

If anyone knows an alternative, do tell. Very much looking forward to it.

chrismorganabout 2 hours ago
> It is hard to read

The hilarious thing here is that without JavaScript, the code is white-on-white, because some of the colouring is added on pre[class*="language-"], but the language-css class is only added to the pre element by JS.

davidd_1004about 2 hours ago
I've seen one of these posts every 6 months for the last 5 years and not a single one has figured out components yet.
zelphirkaltabout 1 hour ago
What exactly is there to figure out or what would you like them to figure out?
Advertisement
bloomcaabout 2 hours ago
The argument basically boils down that in non-component approach (so not a modern web framework) it is harder to reason if you use tailwind classes. The rest is some serious bikeshedding, imo.

I personally started with atomic CSS framework (that was before Tailwind, we had our own) and it has both ups and downs, but overall it is really nice to use once you learn it, and it is not really hard to do so. It does not do anything to enforce variables, but that's why you need to roll either your own layout primitive components or some classes.

croemerabout 2 hours ago
> there is a ceiling of basic classes you have to internalize

I think you mean floor. Floor is a minimum you need. Ceiling would be the maximum you can achieve.

Below this floor you're not useful. There's a ceiling to how much you can do with no code tools.

tmgldnabout 2 hours ago
Tailwind didn't happen by chance - it was the culmination of many other failed philosophies for addressing a problem with CSS when it gets large.

Centrally the problem is this: large CSS requires a lot of active effort to prevent it becoming spaghetti code.

Writing your own CSS can work in solo projects or small projects but Tailwind was designed for large projects, teams and developers with an irrational fear of CSS.

LunicLynxabout 2 hours ago
The problem isn’t tailwind, it’s css.

It always has been css.

That being said, it’s a hard problem and I don’t have a better idea.

Tailwind seems to at least fix or move the problem in the right direction.

qsortabout 2 hours ago
Counterpoint: the problem is actually HTML and most of webtech is increasingly elaborate cope mechanisms to deal with the original sin.
CerebralCodingabout 2 hours ago
I think having an unmoderated chat directly on the page certainly is a choice…
afavourabout 1 hour ago
Honestly I tire of this debate. Both sides have good points have both choices are valid.

I don’t particularly like Tailwind because I know and like CSS. It’s powerful, Tailwild stands in the way of me doing what I want with it. But in this thread you’ll see people saying “it’s great, I haven’t had to learn any CSS in years” and that’s not an invalid viewpoint.

Tailwind is to CSS what React is to the DOM, if not even more so. If you’re working on a ton of boilerplate UI it lets you get the job done without having to learn the core technology being used. For better or worse that’s where the industry is today.

All I would say is that solely Tailwild folks owe it to themselves to look at modern CSS sometime. The arrival of variables in particular is a gamechanger and makes things like palettes and theming far more intuitive than it ever used to be. When I see how Tailwind handles dark mode I cringe. With raw CSS you set a color palette as variables then override them with a media query. The element itself doesn’t need to have anything added.

Aeolosabout 1 hour ago
That’s exactly how I’m doing this using tailwind and daisyui though, so I’m not sure what point you are trying to make?

My global tailwind.css defines two sets of css vars for the light and dark theme, and it all gets applied globally with a single line in my root html template. I don’t need to touch my markup. Tailwind simply compiles this down to a single css file in the end.

neuroticnews25about 1 hour ago
The cat shoutbox thing was fun, but it stopped working.
LauraMediaabout 2 hours ago
I agree with all points and they are the reason I'm very selective which project uses it and which doesn't.

It did give me some ideas for my own stylesheet writing though. The colorsystem is something even non-tailwind projects will have now.

evcalderaabout 2 hours ago
Tailwind is great. Not sure why you'd use anything else at this point.
tuyiownabout 2 hours ago
I’d be rather interested in a recommandation that don’t comes with de usuals pits of others solutions and comes with a the actual css code that will apply to the element displayed in autocomplete while editing the html / jsx.
Advertisement
progxabout 2 hours ago
if you don't like this.

  .button {
      @apply py-2 px-4 bg-indigo-500 text-white font-semibold rounded-lg hover:bg-indigo-700 focus:bg-indigo-700;
  }

why not write it like this?

  .button {
    @apply
      py-2
      px-4
      bg-indigo-500
      text-white
      font-semibold
      rounded-lg
      hover:bg-indigo-700
      focus:bg-indigo-700
    ;
  }
progxabout 2 hours ago
Or:

  .button {
    padding: var(--gap-s) var(--gap-m);
    background-color: var(--color-indigo);
    color: var(--color-white);
    font-weight: 700;
    border-radius: var(--gap-s);
    &:hover, &:focus {
        background-color: var(--color-indigo-hover);
    }
  }
Fair comparison (i really don't like this too):

  .button { padding: var(--gap-s) var(--gap-m); background-color: var(--color-indigo); color: var(--color-white); font-weight: 700; border-radius: var(--gap-s);    &:hover, &:focus { background-color: var(--color-indigo-hover); } }
;-)
progxabout 2 hours ago
"Nothing stops you from using sky-400 and blue-400 in the same project. Consistency still depends on your discipline, not on the framework."

And how did plain css solve that? You're mixing up a few issues there.

vb-8448about 2 hours ago
Not a big fan of vanilla tailwindcss too, but (from the perspective of someone that needs the job done) "just use modern CSS" as the author suggest is even worse.
input_shabout 2 hours ago
My counter-argument: I can copy any cool-looking Tailwind element I find on the Internet into my own project and it'll look exactly the same.
zkmonabout 2 hours ago
I think tailwind helps. It is same as AI prompting, but in a deterministic and fine-grained way. Bottom line - it reduces the time to build.
dmitrijbelikovabout 1 hour ago
I'm still on bootstrap, and it still works for me.
nehalemabout 2 hours ago
I wish it would at least be kept out of UI frameworks.
mgaunardabout 2 hours ago
We already tried the fully semantic web in the days of XHTML, where the document is purely semantics and CSS purely transformation.

It didn't work in practice, because people want to structure their document based on how they expect it to be presented.

My understanding is thay HTML5 was built on the understanding that language purity just went in the way of productive compromise.

latexrabout 2 hours ago
It’s funny how, upon opening the website, you’re immediately greeted with a “Was Top 1 on Hacker News” link leading back here, but (at time of writing) it has under 50 points and almost every comment disagrees with the post.

While I don’t really have a strong opinion on Tailwind CSS, I do have a strong negative reaction to websites who advertise to everyone how many people are on the page, especially when that’s shoved in our faces and people can send malware links and spam to everyone else (as is happening in droves).

verve_ratabout 2 hours ago
I know complaining about the site is poor form, but it is really hard to take advice seriously for a site that lets other visitors spam... just general internet things to other visitors.

Cute idea, but it is pretty clear the author doesn't consider practical consequences, so why should I trust their judgement about Tailwind?

de6u99erabout 1 hour ago
ok
Advertisement
dankobgdabout 1 hour ago
tailwind is the worst thing ever, i hate this so much
epolanskiabout 2 hours ago
I can immediately spot organizations void of any skilled frontend engineering leadership by their use of Tailwind.

Generally coupled by some memory leaking React soup, solving 2016 SPA problems in 2026.

Likely 30-something years old MIT-bred leetcode ninjas that know little to nothing about front end technologies in the first place. They don't even remember _why_ the industry reached for client-side rendering library at some point. They think it's for interactivity. HN comments are quite telling about it.

Bloated slop is bloated slop, I still have to find a single example proving me wrong, and what's produced on top of react-tailwind by billion dollar companies just confirms my negative bias around the people using it, the results speak for themselves.

cpursleyabout 2 hours ago
My sass customers don't even know what css means, it's fine. Nobody cares as long as the things they expect are on the page in the right position and font is readable.
azangruabout 1 hour ago
Do your sass customers know what javascript is or how it's different from java? Does this mean developers shouldn't care either?
oldmoozyabout 2 hours ago
Nobody does. Yet it is everywhere, like AI slop.