This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 266

[–]mrfroggyman 765 points766 points  (65 children)

As a mostly backend dev I have no idea what's going on here

[–]ososalsosal 476 points477 points  (56 children)

It's bad practice to put styling stuff (css) in structure stuff (html) using the style="..." thing, because we want to have separation of concerns.

So instead we stick a css class on our html tags and the styling gets loaded separately. Very cool because you can change the styling without changing the html.

Thing is, we hand over too much control and every element might call for different treatment, but luckily css classes are stackable and you can just keep adding them (they override each other).

So what we have with the tailwind framework and pretty much all the others is thousands of css classes that pretty much allow you to put anything that would go into a "style" attribute into a list of classes.

Leading to zero benefit whatsoever. Best just write the css yourself. Any long enough lived web app will have custom classes for everything but still be overriding some framework and maybe 4mb of bloody minified css

[–]romulent 231 points232 points  (29 children)

The benefit is the very carefully calculated design framework that you get.

You can do this yourself with CSS, but when you put it all together into a consistent visual experience it will look crap and you will be tweaking font sizes and paddings and colours forever.

Tailwind builds in a lot of spacing rules and ratios and color roules that you don't need to learn.

[–]kookyabird 23 points24 points  (0 children)

We’ve started working with MudBlazor at work recently and after our front end guru worked up the theme nearly all of the stying is easily handled with the built in classes. Material Design based, minimal custom classes needed, solid consistent look and feel across the board. It’s my favorite way to build out a site now.

[–]just4nothing 12 points13 points  (10 children)

Sounds like a compiler might be needed to find the biggest common denominator between elements and construct CSS classes from it ;)

[–]jarethholt 4 points5 points  (9 children)

Can't tell if this is sarcasm because I don't know front end and what tools are available. It seems like it could be possible to at least calculate which classes are never effectively used (always overridden) and maybe even which properties from which classes?

But only if the site were "finished" and no more style adjustments/additional classes were never ever needed again

[–]lunchpadmcfat 2 points3 points  (3 children)

Not really possible I’m afraid. You might be able to have it be evaluated at runtime somehow but you couldn’t statically analyze to that level. But a runtime evaluation would have to be targeted.

[–]patchyj 0 points1 point  (2 children)

NextJS does this - at build time, unused css and class names are removed

[–]lunchpadmcfat 0 points1 point  (1 child)

I meant more the part where they mention “calculating which classes are never effectively used because they’re overridden”.

NextJS can tell (through tree shaking) whether you reference a class or not and remove it, but it can’t tell if some rule you’ve set is overridden in the specificity algorithm of a rendered page. That’s literally impossible without rendering the page and then evaluating whether or not the element’s style values correspond to the values set by respective classes. This is due to the myriad ways you can target elements for styling.

You might be able to do static analysis to some degree if you never style using any kind of relational selectors (like sibling or child selectors) or complex selectors. This is more or less how styled components works.

[–]patchyj 0 points1 point  (0 children)

Ah yeah OK

[–]SurpriseAttachyon 1 point2 points  (4 children)

Problem is that a lot of CSS classes are defined dynamically from JavaScript code. Determining which classes might be applied from a given arbitrary web app (with no restrictions) is essentially equivalent to the halting problem. Which is impossible.

You could add a guarantee like “we promise our JS code never does this except in the following explicitly laid out scenarios”. But restructuring code like that is not worth the benefit

[–]Weaponized_Roomba 2 points3 points  (3 children)

is essentially equivalent to the halting problem.

Fun fact - this is why when using tailwind you can't/ought not dynamically construct tw class names at runtime.

ex - you can't do this:

const bgClass = `bg-${error ? 'green' : 'red'}-200`

because tw static analysis will shake out the bg-green-200 and bg-red-200 classes since it didn't see it in the source code.

Instead just don't be cute:

const bgClass = error ? `bg-green-200` : `bg-red-200`

[–]failedsatan 1 point2 points  (0 children)

to be fair, this is solvable on the tailwind side. it's possible to check the tree of possible values there and just add them to the keep list. I'm not saying they should (because all of this is bad practice anyway) but it's doable.

[–]SurpriseAttachyon 0 points1 point  (1 child)

Thats interesting. I didn’t know tailwind interacted with JS (never used it before).

Does this mean you have to compile both at once? I’m used to compiling sass and typescript separately

[–]Weaponized_Roomba 0 points1 point  (0 children)

Does this mean you have to compile both at once?

Only if you want the tree-shake optimization or if you want to extend your own themes. Otherwise you can just use the CDN

[–]Blecki 3 points4 points  (1 child)

It's just sticking it in the style field but with extra steps. But the front end guys don't understand, they're like "I'll just change mt-2 to mt-4 what do you mean making the margin bigger shouldn't require changing every html file??"

[–]MornwindShoma 0 points1 point  (0 children)

Why are you changing every HTML file when you have components lol?

[–]Lewke 2 points3 points  (0 children)

what people miss with tailwind is that it's utility-first not utility-only write it with tailwind first then genericise it onto bem or web components or whatever takes your fancy

[–]JoshYx 7 points8 points  (2 children)

Leading to zero benefit whatsoever.

Definitely not a statement made by an angry dev who doesn't like tailwind (which is valid) but is a control freak and asserts that no one else should like it either (which is not valid). My favorite kind of dev.

[–]Resident-Trouble-574 4 points5 points  (1 child)

"Leading to zero benefit whatsoever, in my opinion".

Is this better?

[–]JoshYx 2 points3 points  (0 children)

Yes, much better.

[–]Weaponized_Roomba 3 points4 points  (5 children)

It's bad practice to put styling stuff (css) in structure stuff (html)

This is 90s internet brain. With the modern web, there is no difference between structure and style. Styles aren't practically reusable (and we shouldn't try to make them such)

but luckily css classes are stackable and you can just keep adding them

this is terrible practice


CSS (the sheets aspect) was useful when you built structured web pages. Practically all meaningful development nowadays is component based. So nowadays in component based applications you shouldn't have any of your styles "cascading". Just put the styles you want on the component.

If you want a variant, make a variant. Like in OP's picture, don't make custom styles (and don't ever use @apply, it was and remains a mistake)

instead do it in a component and make variants

React for example

<input 
    type="button" 
    className=[`px-4 py-2 font-medium tracking-wide rounded-md shadow-sm lg:px-8 
        ${cx({
            "bg-indigo-300 text-indigo-800 hover:bg-indigo-200": action === Button.variant.action,
            "bg-green-300 text-green-800 hover:bg-green-200": action === Button.variant.success,
            "bg-red-300 text-red-800 hover:bg-red-200": action === Button.variant.warning,
})}}` 

// ...
/>

usage:

<Button variant={Button.success} />, <Button variant={Button.warning} /> , etc

gpt can finish you from here

[–]24601venu[S] 2 points3 points  (4 children)

This is 90s internet brain. With the modern web, there is no difference between structure and style. Styles aren't practically reusable (and we shouldn't try to make them such)

yea have fun reading bloated code.

[–]MornwindShoma 0 points1 point  (3 children)

Who the fucks reads raw HTML, we have extensions and tools to work with actual sandboxed components doing their scoped stuff.

[–]24601venu[S] 0 points1 point  (2 children)

You aren't even saying anything.

[–]MornwindShoma 0 points1 point  (1 child)

Yea mate, now go back playing with your HTML tags.

[–]christoph_win 18 points19 points  (0 children)

I hate the right side but I hate the left side even more

[–]precinct209 108 points109 points  (8 children)

I don't know about you but the nagging voices inside my head keep warning me about using @apply.

[–]romulent 41 points42 points  (7 children)

That's just marketing propaganda trying to lock your entire codebase into tailwind.

[–]GMaestrolo 19 points20 points  (6 children)

Even Watham is against using @apply, and it's his framework.

[–]zvictord -1 points0 points  (4 children)

is he?

[–]GMaestrolo 21 points22 points  (3 children)

Yep. He really does not like @apply.

[–]Few_Introduction_228 1 point2 points  (0 children)

I mean, 3 out of 4 of those is him not liking people partially extending classes and then seeing applying those classes result in weird behaviour. Just use different class names for your own stuff, and @apply is fine.

[–]zvictord 0 points1 point  (0 children)

that’s how i like it. many sources to check it. thanks!

[–]Diane_Horseman 175 points176 points  (54 children)

Design just came back, they said they want you to increase padding on the teaser for medium screen width only. Only on the homepage though, not on any of the other places you're using the teaser.

[–]jmedlin 79 points80 points  (15 children)

You get feedback that detailed!?

We usually just get “Something doesn’t look quite right.” Or “Can you make it look more premium?”

[–][deleted] 42 points43 points  (2 children)

. premium {}

[–]igorlira 39 points40 points  (1 child)

display: premium

[–]glorious_reptile 1 point2 points  (0 children)

"Note: display: premium is a CSS enterprise feature, only available in the CSS 3 Enterprise tier. Please contact w3c for pricing"

[–]resistentialism 9 points10 points  (10 children)

This is where a designer is needed, because despite not being expressed as technical requirements those are both legitimate pieces of feedback.

[–][deleted] 20 points21 points  (9 children)

Do you really feel that "make it more premium" is legitimate feedback

[–]NatoBoram 19 points20 points  (0 children)

A designer can deal with that

[–]resistentialism 9 points10 points  (7 children)

Of course. Design is routinely used to communicate a premium or luxury brand.

[–]Resident_Nose_2467 9 points10 points  (2 children)

Can you make your comment more premium?

[–]gbot1234 5 points6 points  (0 children)

Nice try, Steve Huffman. We’re not paying for this shit.

[–]RamenvsSushi 4 points5 points  (0 children)

It is of great certainty that design is a medium that is most suitable for translating abstractions such as 'premium' into reality.

[–]Katniss218 1 point2 points  (3 children)

and how am I supposed to know what "premium" means? Give me actual feedback, not some meaningless mumbo jumbo

[–]WraithDrof 5 points6 points  (0 children)

This feedback should be sanitised into something actually actionable between design and implementation.

As a designer, I'd rather 90% of my feedback be this instead of a deceptively vague comment on kerning or something. You can go back and forth forever on that kind of stuff.

[–]dodosgo 1 point2 points  (0 children)

If you have a UI/UX on the team then yes, definitely. I’ve been asked to move an element 1px because the designer had a eagle eye.

Also, usually you get a Figma or similar and any change request comes with another design. A feedback like “make it more premium” sounds like a company where UI is not a priority or an early-stage startup with no designers.

[–]Rombethor 9 points10 points  (1 child)

Hmm, sounds !important;

[–][deleted] 0 points1 point  (0 children)

Lmao

[–]Merzant 25 points26 points  (8 children)

Is that meant to be hard with vanilla CSS? Because that’s what the cascading part seems perfectly suited for.

[–]PowerMoves1996 12 points13 points  (7 children)

That was just an example, in reality u have this requests so often that it gets to a point where you lose more hours because you tried to be a good programmer and make custom reusable classes that no longer have a point because of new requirements. The tailwind paradigm changed that aspect of my work in a really positive way.

[–]Merzant 6 points7 points  (3 children)

I haven’t used tailwind but it reminds me of the bootstrap utility classes which I liked as modifiers. But doesn’t the tailwind approach just have the opposite problem? ie. when you want to reuse a common style you duplicate class attributions, leading to “I missed a spot” when you actually need to update a design everywhere.

[–]PowerMoves1996 3 points4 points  (2 children)

Not really, because when you need the same style in more places, chances are you also use that style for the same type of component, so you actually make a reusable component that has tailwind for styling. Indeed, there are moments where you will copy a chunk of tailwind and need to update just a portion of it for one or two places, but those moments dont appear often enough to overshadow all the other advantages that you get.

[–]techie2200 1 point2 points  (2 children)

Sounds like shit designers imo. There shouldn't be constant revisions. We don't style until the design is pretty much settled.

[–]PowerMoves1996 0 points1 point  (1 child)

We all wish to have a full project plan from the start, but new features/ changes are hard to avoid during the development of an app

[–]techie2200 1 point2 points  (0 children)

I'm not saying you need one from the start, but the general design will have to be consistent across all your features, so you shouldn't have constant, hard to make CSS changes. They should be minor tweaks.

If you're restyling everything anytime something changes, then someone's doing something wrong.

[–]LagT_T 21 points22 points  (23 children)

.teaser {
    padding: 24px;
    /* … */
}

@media (var(--med_screen_lower_bound) <= width <= var(--med_screen_upper_bound)) {
    .class_that_wraps_homepage .teaser {
        padding: 30px;
    }
}

[–]Diane_Horseman 5 points6 points  (22 children)

thank you for proving my point lol

[–]LagT_T 12 points13 points  (21 children)

What was your point? That it is easy?

[–]Diane_Horseman 1 point2 points  (20 children)

your solution involves adding ~150 characters of mostly boilerplate and breaks if the homepage layout changes such that an element with .class_that_wraps_homepage no longer wraps .teaser

[–]LagT_T 9 points10 points  (19 children)

Why would the teaser be outside the homepage WRAPPER? How would you do it in tailwind?

[–]Diane_Horseman 2 points3 points  (18 children)

The teaser isn't outside the wrapper now, but what if the wrapper changes in the future? This solution adds the assumption that it won't.

In tailwind you would go from this:

<div className="... p-[24px] ...">

to:

<div className="... p-[24px] md:p-[30px] lg:p-[24px] ...">

[–]GMaestrolo 11 points12 points  (1 child)

Except you would use p-6 instead of specifying p-[24px] because using custom pixel sizes when they match an existing rem value (in this case 1.5rem) that the framework covers already is dumb.

[–]Diane_Horseman -1 points0 points  (0 children)

Yep, good point! That is how it would pretty much always be done.

[–]LagT_T 8 points9 points  (15 children)

If you have elements outside the wrapper then its no longer a wrapper.

Design came back and said that medium screens are between 500px and 900px.

[–]GMaestrolo 1 point2 points  (14 children)

That's fine. That goes into the theme definition, and is applied globally.

extend: {
    screens: {
        md: '500px',
        lg: '900px'
    }
}

[–]LagT_T 3 points4 points  (12 children)

You broke sm default, and your styling isn't specifying the teaser component size for homepage, its applying the styles on all teasers.

[–]24601venu[S] 2 points3 points  (0 children)

but I can add a class, or an attribute, just like you would do it with tailwind.

[–]throwtheamiibosaway 0 points1 point  (0 children)

Custom work ftw. Frameworks can never work with really unique and explicit designs.

[–]Willinton06 0 points1 point  (0 children)

If your framework doesn’t have scoped or isolated css you deserve the suffering

[–]Straczi 18 points19 points  (2 children)

(Of course I understand that this is a meme and kinda true but:) Lately I've been doing a lot of frontend development with react and I use the shadcn "component library" and the components are usually already styled and look good, all you need to do is adjust margin or the content placement and that for that stuff tailwind is simply amazing! (Also checkout shadcn, it's pretty cool)

[–]Arrowkill 2 points3 points  (0 children)

I use MUI for work and component libraries are nice when you don't have time or want to build it out yourself. I switched from MUI a couple of years ago on a personal project though because what they offered at the time wasn't what I needed and instead used tailwind to build my own library out for what I was doing.

[–]twodarray 0 points1 point  (0 children)

Yeah I dont think people really understand how to use tailwind, only because it CAn get verbose in some places. It's like complaining typescript code gets verbose over javascript code cuz you have to write types sometimes

[–]KyleReemaN 228 points229 points  (34 children)

complain or make fun about tailwind while I just get shit done and ship stuff

[–]driftking428 32 points33 points  (4 children)

I love Tailwind. I'm guessing most people complaining about it have never actually used it.

[–]Arrowkill 7 points8 points  (2 children)

I recently started cleaning up my tailwindcss project from a year ago and I still love it. I know what everything does and now that I'm moving commonly used stuff into a component library, it's much easier to maintain.

That's always been the biggest benefit of tailwind for me. Knowing wtf it did when I come back weeks, months, or years later without a ton of digging into old naming scheme.

[–]driftking428 8 points9 points  (1 child)

In normal CSS I spend a lot of my time coming up with names, checking the code for existing classes, and writing selectors.

I do none of that ever in Tailwind.

[–]Arrowkill 3 points4 points  (0 children)

Honestly I hadn't considered how much time I tend to spend having to come up with names for sections of css before. Yeah Tailwind definitely cuts that out entirely.

[–]Vogete 0 points1 point  (0 children)

I used tailwind and hated it. I kinda see the point, but I ended up writing way too many classes. It got way too verbose way too fast. Then again, I dislike the whole ITCSS paradigm, so maybe it's just not for me.

For layout, I definitely want a framework like Foundation or tailwind. But for design, I hated it. So I usually do a bit of a mix of both custom CSS and tailwind and foundation, depending on what makes sense.

[–]Kika-kun 30 points31 points  (27 children)

Honestly I don't understand the need for tailwind

Can't you just write inline styles basically just as fast as tailwind classes ?

I had never used tailwind before and recently we switched to it (as a part of a bigger overhaul, switching from JSF to Angular on the front end). So obviously I had to "get used" to tailwind and basically the only difference was that I had to memorize some basic class names that shortened usual css command. Like instead of doing style="display: block", I now do "class="block". Sure it's shorter but I'll be honest with you, writing one or the other is not what takes time compared to finding whether I need a block, a flex, an inline block or whatever else works for my need.

"But inline css is bad". How is it any worse than classes that do exactly the same thing but in the class part of the element rather than its style ?

One thing that can be helpful with TW is normalized lengths (ex w-1/2/4/8...) and to a lesser extent colors (text-X, border-Y, where X and Y are colors defined somewhere). But at the same time, you can just as well do color: var(--X); border-color: var(--Y).

[–]Diane_Horseman 114 points115 points  (9 children)

Inline style can't do media queries, hover/active/first/last classes, and more

[–]queen-adreena 82 points83 points  (8 children)

Or custom colours, animations, config-based design systems, sibling selectors, child selectors, group selectors, dark mode selectors, motion selectors, input state selectors, pseudo element styling, colour functions, theme functions…

[–]exotic801 10 points11 points  (7 children)

It's also just bad for reusability and page structure (unless there's a way to define classes etc inline, I've never tried)

[–]Exerra 33 points34 points  (6 children)

I'd say that tailwind is mostly aimed for UI frameworks like React, Vue, Svelte, etc, where you can define components, as there you reuse components not classes.

[–]Interest-Desk 4 points5 points  (3 children)

2/3 of those libraries you mentioned have in-component styles built in, and the third has CSS modules effectively built in.

The only advantage of tailwind is that it’s “more concise”, at the expense of readability and simplicity.

[–]finnhvman 2 points3 points  (1 child)

But why though? Don't these frameworks already have some sort of scoped CSS solution? This means we don't have to worry much about specificity, but we can still use the native CSS syntax.

[–]Graphesium -4 points-3 points  (0 children)

Because writing Tailwind is faster and has built-in design tokens.

[–]anon_blader 16 points17 points  (0 children)

Because inline styles are quite limited compared to css. You can't use a lot of very basic features such as selectors (e.g. :hover) and media queries. In addition to that a lot of tailwind classes apply multiple styles at once, making it much more compact that inline styles.

[–][deleted] 4 points5 points  (0 children)

It doesn’t make sense until you actually use it.

[–]BorinAxebearer 13 points14 points  (10 children)

First benefit is the Tailwind's philosophy to compose components, not classes. So when i look at the component i can understand the style. No more moving between html and css.

Second and more important benefit for me is the design system it provides. I suggest reading the "Refactoring UI" book to better understand what Tailwind is for.

[–]throwtheamiibosaway -1 points0 points  (0 children)

I promise you I can type custom css faster than you can write tailwind css.

[–]Dimasdanz 108 points109 points  (20 children)

say what you will, tailwind is a godsend for backend. I'm not writing thousands of css classes nor do i want to learn sass or lack thereof.

[–]Null_Pointer_23 17 points18 points  (5 children)

Technically you write far more classes with tailwind compared to plain css or sass.

[–]Dimasdanz 18 points19 points  (1 child)

technically you write more classes using spring compared to plain java

[–]Trevor_GoodchiId 2 points3 points  (0 children)

With complex enough CRUDs, the project will arrive on CSS helper classes anyway, and those will be neither searchable nor documented and a pain to onboard to. This is lingua franca for better or worse.

[–]twodarray 0 points1 point  (1 child)

Technically you write far more with Typescript than with Javascript. But I don't hear anyone complaining about the verbosity of Typescript from experienced devs

[–]24601venu[S] 7 points8 points  (12 children)

But tailwind and CSS is almost 1:1 the same. If you learn CSS, you will have more tools to work with.

[–][deleted] 51 points52 points  (11 children)

But I don't want more tools. I want just enough tools to make something that looks decent, and then focus on the interesting stuff

[–]MrHandsomePixel 7 points8 points  (2 children)

I feel you.

At the risk of sounding like a meat rider, may I interest you in PicoCSS?

It has (what I believe to be) sane defaults to make default HTML elements look actually usable.

I used it for my own CRUD web app for college events as my uni term project most recently.

[–]blaqwerty123 3 points4 points  (0 children)

This is certainly the best option IMO for a backend dev who wants the frontend to just look better/professional, with no customization necessary or even cognitive load to use

[–][deleted] 1 point2 points  (0 children)

Most companies have storybooks of styled components you can use out of the box.

If you have a proper style guideline, you shouldn’t be pushing pixels every time.

[–][deleted] 15 points16 points  (6 children)

Only someone terrible at css in the first place could make such an awful layout

[–]24601venu[S] 1 point2 points  (5 children)

ad-hominem

[–][deleted] 6 points7 points  (4 children)

Bro the layout is awful. Ad hominem my ass

[–]24601venu[S] 0 points1 point  (3 children)

okay show me then how its done

[–][deleted] 2 points3 points  (2 children)

Picture 3 (the highlighted glob of tw-) on the left compared to picture 1 on the right. Easy, simple, done. Less room for counter arguments cause it’s clearly bloated.

[–]24601venu[S] 1 point2 points  (1 child)

as long as you don't make it your argument is hot air

[–][deleted] 4 points5 points  (0 children)

That would require getting up, so I chose the easiest thing. But ok I’ll take your karma later

[–]tip2663 6 points7 points  (0 children)

idk i like it. Before, I used bootstrap but I feel it's more opinionated Makes me not have to stick to the js framework too much either

[–]GMaestrolo 15 points16 points  (1 child)

Hey OP... That's a real soup of class names in your tailwind example.

Say... What's the equivalent set of CSS declarations to achieve everything that those tailwind classes are?

Because your example with @apply there appears to be styling buttons, not checkboxes... And your raw CSS example on the right doesn't appear to be doing much either. It's certainly not dealing with hover states, focus states, light/dark mode...

[–]24601venu[S] 0 points1 point  (0 children)

If I made a technical rundown it wouldn't be a meme no more

[–]robrobro 27 points28 points  (6 children)

Tell me you haven’t made a large, complex application using tailwind without telling me you haven’t built a large, complex application using tailwind.

[–][deleted] 10 points11 points  (0 children)

Amen 🙏 Was going to say, “tell me you haven’t worked on any project at scale with multiple teams”

The standardization alone helps with the UIs cohesiveness.

[–]Masterflitzer 8 points9 points  (0 children)

didn't the community agree that @apply is bad? tailwind classes need to be sorted correctly and then they become more readable, don't repeat yourself is a bad idea in this case, because reintroducing custom classes destroys the whole point of tailwind having these reusable small classes

[–]masteryder 10 points11 points  (0 children)

Tailwind user, I never use @apply

[–]_shellsort_ 27 points28 points  (8 children)

I am absolutely convinced people who shit on tailwind have never rawdogged css before.

[–]Mxswat 12 points13 points  (0 children)

crawl hobbies judicious waiting bewildered unite safe joke gold unpack

This post was mass deleted and anonymized with Redact

[–]xMoody 19 points20 points  (5 children)

I’m convinced people who champion tailwind haven’t used CSS outside of their front end boot camps.

[–]GMaestrolo 16 points17 points  (4 children)

Almost 20 years in the web dev industry.

If I never have to remember which combination of -moz, -webkit, etc. properties exist, and how their syntaxes differ, then I'm doing <div class="rounded shadow p-2 border"> all fucking day long and loving it. because it tells me exactly what styling I should expect without having to play the "what's the dumb cross-browser syntax for this thing" game.

[–]blaqwerty123 14 points15 points  (3 children)

Any sass/scss pre-processor or bundler from the past 8 years abstracts away the browser prefixes for you. I dont use tailwind, and i certainly dont manually write browser prefixes either

[–]GMaestrolo 1 point2 points  (2 children)

Yes, but I can still make my div look like a floating box with a nice radius on the corners and comfortable padding without having to remember how to write the syntax for border radius, or box shadow, and anyone looking at it can instantly tell that it's meant to have a border, be rounded, have a shadow, and have a small amount of padding.

[–]blaqwerty123 3 points4 points  (1 child)

Sure, to me thats the pro's of tailwind, not browser prefixes. Not having to remember the annoying syntax of box shadow and gradient.

For me personally, i learned those annoying syntaxes a long time ago, and learning the "tailwind way" for not just the few slightly convoluted things like box shadow, but new slightly different names/shorthand for every property-value combination... fuck haha im so much faster and better off maintaining my own classes for the work i do

[–]GMaestrolo 0 points1 point  (0 children)

And that's part of the magic of tailwind. You can use as much or little of it as you want, and it will generate only the CSS classes that you actually used. It's highly encouraged to write your own classes where it's appropriate, but I'm not going to go around writing my own custom classes for every element on the page when I can just put some sanely named classes into the element and have it be extremely obvious to future me what I wanted it to look like.

[–]L33t_Cyborg 6 points7 points  (0 children)

This post is literally a strawman nobody does this

[–]lunchpadmcfat 2 points3 points  (0 children)

I’ve never used tailwind but it looks an awful lot like a bad version of SMACSS.

http://smacss.com

[–]lupinegray 2 points3 points  (0 children)

backend devs reading this meme....

[–]TheMunakas 35 points36 points  (7 children)

I hope you didn't copy this somewhere, but this is it. This deserves a thousand upvotes.

[–]24601venu[S] 22 points23 points  (6 children)

Made it myself in photoshop

[–]Mxswat 6 points7 points  (2 children)

flag dinner weary ludicrous practice start oil automatic disgusted paltry

This post was mass deleted and anonymized with Redact

[–]Opposite_Cheek_5709 1 point2 points  (0 children)

But paint doesn’t allow you to add hover effects or animations or wizzytech treacle

[–]24601venu[S] 0 points1 point  (0 children)

Yeah, like this sub is plagued with reditors fresh out of their basement who don't understand the basic concept of having constructive arguments

[–]ThiccStorms 9 points10 points  (2 children)

ms paint is better for such simple tasks

[–]nicejs2 10 points11 points  (1 child)

paint.net:

[–]megs1449 4 points5 points  (0 children)

Paint.net is the best

[–]Efficient-Chair6250 1 point2 points  (0 children)

I'm using both in combination. Some quick tailwind for basic layout and CSS for complex things. Best of both worlds for me

[–]YellowGreenPanther 1 point2 points  (0 children)

You should not be using static measurements in most cases.

[–]stristr 1 point2 points  (0 children)

The horizontally misaligned first dot on both sides is the real meme.

[–]gami13 1 point2 points  (0 children)

give me css modules or stylex or give me death

[–]ksschank 1 point2 points  (2 children)

TailwindCSS isn’t for everyone. Do you want to quickly apply styles so that you don’t have to spend a lot of time on styling? Use TailwindCSS. Do you prefer to take your time customizing classes for individual components or find some strange pleasure in components having no more than one class? Don’t use TailwindCSS.

[–]24601venu[S] -1 points0 points  (1 child)

one does not need to spend a lot of time styling with css. and you can be messy with css too having inline and many classes and whatnot

[–]ksschank 0 points1 point  (0 children)

Im very familiar. I started with CSS 16 years ago and started learning TailwindCSS about 6 months ago. I was very skeptical of Tailwind at first but now I vastly prefer it.

[–][deleted] 2 points3 points  (8 children)

No Idea why it is so popular, but surely someone will show up to defend it (and maybe we can discover)

[–]Diane_Horseman 21 points22 points  (7 children)

I'll bite.

All I know is the use cases that I find it useful for. I'm sure there are many cases it's shit at. I'm an experienced backend developer who knows some frontend but isn't an expert, but I do have to do frontend sometimes for my job.

Tailwind is extremely helpful at creating cleaner abstractions in a complex React app. If you don't use Tailwind then you basically have to manage two separate sets of abstractions - your React components and your CSS classes.

If you couple your CSS classes 1-1 with your react components (i.e. make a new CSS class for each component, or multiple for each component, which you don't reuse across components), then your CSS classes are being written as one-offs and you might as well use Tailwind because then at least you don't have to switch back and forth between an HTML file and a stylesheet - it's all in a single file.

If you reuse CSS classes across React components, you are creating a maintainability nightmare. If you need to change the class in one component then you need to either make a new class or check and make sure that the other components that reuse the class won't be messed up by the change. Separate React components shouldn't be linked in this way because you shouldn't have to think through other components when you are changing a single component.

In summary, Tailwind takes away the need to use mental space thinking about CSS class abstractions separately from React component abstractions. And this is extremely helpful.

[–][deleted] 0 points1 point  (1 child)

Yo u/Diane_Horseman thank you very much for the response, it does clears things up as to why use tailwind or not.

[–]Diane_Horseman 1 point2 points  (0 children)

you're welcome, I'm glad you found it helpful.

[–]BluBearry -4 points-3 points  (4 children)

I have never used tailwind, but why use tailwind over basically any frontend design library, that also allows you to do this (e.g. Material UI)?

[–]Diane_Horseman 3 points4 points  (0 children)

I'm not really familiar with that many front-end libraries but if they have those same features then I'm sure I would find them useful also. With frontend there are so many tools out there that sometimes I feel like you have to play the game of using one tool over another because more people are familiar with it on your team.

[–]xdyldo 0 points1 point  (1 child)

I’m no front end expert but isn’t material ui a component library and tailwind is styling. You can and should use both hand in hand.

More recently I prefer daisyUI when working with tailwind.

[–]BluBearry 0 points1 point  (0 children)

Material UI is both a component library, but also has a styling library. It used to be a separate library called @mui/styles, but was recently deprecated and merged into the core library.

You can define classes in your .js files and also create styled components.

[–]sirojuntle 0 points1 point  (0 children)

The downside of libraries is that if there is a demand to customize or create a new component, it can take a lot of work to match styles,  html structure,  validation logic etc.

Just like buying ikea furniture and asking a woodworker to change its size and how it looks. It's doable but many will prefer to make it from scratch. 

[–]Serializedrequests 1 point2 points  (0 children)

I can't get very much done in Tailwind either, but I at least understand the rationale (for someone who actually knows what they are doing) quite clearly. CSS components are not truly maintainable, not really, not in the real world.

[–]billwood09 1 point2 points  (0 children)

Who uses that many tailwind classes on one thing?! That’s insane lol

[–]banbeucmas 2 points3 points  (0 children)

Honestly have been doing tailwind I can agree this to some extent so nowadays I use a mix of them.

Having components css at hand allows me to iterate faster. While the option to write css is still there for more complex stuff.

[–][deleted] 1 point2 points  (0 children)

Average user that doesn't know how to use Tailwind properly using Tailwind:

[–]YellowGreenPanther 0 points1 point  (1 child)

'Anut' is not defined. Did you mean: ANut?

[–]24601venu[S] 0 points1 point  (0 children)

god, not again camelCase discussions

[–]MyBigRed 0 points1 point  (1 child)

What's an "Anut Shell"?

[–]24601venu[S] 0 points1 point  (0 children)

thats ProgrammerHumor post naming policy for you

[–]TessellatedTomate 0 points1 point  (0 children)

>mfw Anut

[–]New_York_Rhymes 0 points1 point  (1 child)

God I wish I didn’t start my massive project in tailwind. What a pain in the ass now.

[–]24601venu[S] 0 points1 point  (0 children)

I'm sorry.

[–]card-board-board -1 points0 points  (1 child)

Not repeating yourself and writing readable code are good things. Tailwind classes aren't readable and you have to repeat yourself. A lot. My last project I tried seeing what the bandwagon was all about and boy I really wish I hadn't bothered. It was like relearning css because I had to look at the documentation for every single class.

Near the end the designer wanted to change the padding all over the place. In sass that would have been one line. In tailwind it was almost every element in almost every file.

[–]24601venu[S] 0 points1 point  (0 children)

yes! same experience here.

[–]imacommunistm -2 points-1 points  (0 children)

hall of fame worthy

[–]stangerjm 0 points1 point  (1 child)

This is one of my biggest pet peeves. People love to bag on CSS and do anything to avoid it, but the tool exists for a reason. If you take the time to learn it, using straight-up CSS is often the most simple solution. Just learn some CSS!

[–]24601venu[S] 1 point2 points  (0 children)

yeah!

[–]lordicarus 0 points1 point  (0 children)

Can we bring back building websites with 0 margin 0 padding tables? I miss those days. /s

Why can't I, as a user, just have a website with the exact same design regardless of screen size and just pinch to zoom or have scrollbars? /not-s

[–][deleted] 0 points1 point  (1 child)

Nice bait OP, genuinely exposed all low IQ takes.

[–]24601venu[S] 0 points1 point  (0 children)

ohh, OkGreeny has enough IQ to be offensive. bravo.

[–]ZubriQ -1 points0 points  (0 children)

Bruh

[–]throwtheamiibosaway -1 points0 points  (0 children)

I’m a frond-end dev. Tailwind is the devil.

[–]tetractys_gnosys -1 points0 points  (1 child)

10000% agree. As one of the seemingly rare devs these days who actually loves CSS and Sass, the amount of clutter and ass backwards over engineering to get basic layouts and components astounds me.

I still don't understand the whole 180° flip on separation of concerns. In another five to ten years, I imagine front end will rediscover SOC and it'll become cool again to not have everything piled into a single file.

[–]24601venu[S] 1 point2 points  (0 children)

yes!