Live data from Hacker News

Why Tailwind CSS Won

matt-rickard.com

421–430 of 559 posts

Re: Why Tailwind CSS Won

#422
post #362

I used tailwind for several personal projects, then realized I was spending way more time than I used to styling things. I switched back to bootstrap for personal projects, where I make a few tweaks to the global theme, then write zero css and very little styling besides things like margins and alignment. It's way easier and enjoyable for me, though I admit that my apps all look pretty generic.

Out of curiosity, do you use react or use any components in those projects? The general consensus seems to be people who are practicing atomic design with components love Tailwind, and people who don't dislike Tailwind.

Re: Why Tailwind CSS Won

#423
post #338

Earlier quoted context omitted.

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 lo…

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 o…

> 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.

> 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.

In my experience that's empirically false. Maybe if you only care about Chrome, but CSS is hell to maintain when you need to keep support for browsers like pre-blink Edge.

Re: Why Tailwind CSS Won

#424
post #140

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_,…

Web technologies like this take hold because they make producing something more attainable to a wider group of people. Who cares if it's "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 a…

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

#425

Earlier quoted context omitted.

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…

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, hav…

Yep, the only even kinda maintainable CSS ends up being tailwind but in another file.

   
      
      Blah

... .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

#426

I love tailwind, and I've been writing CSS professionally since CSS2.1. I have often debated with many developer friends why it has performed so well, and this article really missed some big reasons: 1. It's works extremely well with the current component-focused UI frameworks (react, svelte, etc). Subsequently, the verboseness that is often a complaint isn't an issue at all, but a feature. 2. Does everything out of…

How do you style with pseudo selectors (e.g. :hover)?

You prefix the class with hover: or focus: etc. very powerful, although this is where a lot of people start to find it gross especially when you add breakpoints into the mix.

Re: Why Tailwind CSS Won

#427
post #394

Folks, while we are at it, what is the best way to learn proper front end for a hobbyst? I'm a decent programmer and work with databases and backend technologies. I want to be able to build simple front ends for the stuff I work on. I've been meaning to dive into D3, but the tutorials for basic front end stuff assume I'm really starting from scratch. But what I'm blocked by is 1) what is a nice workflow for developme…

I think the Front-End is split into multiple different parts that work together but I sometimes think about them separately. A) The organization of the individual parts. B) The 'look' of those parts. C) Technical stuff like Accessibility, parent-child coupling, etc.

Learning A can be pretty quick for some basics, learning B is a rabbit hole that can take ages to 'learn'. The good news is most of what you need is for something 'competent' is in A

To answer your points below:

1) Front load your design. The equivalent to Pseudocode for the Front-End is to wireframe. Consider all of your pieces, how they should be grouped, and why. There are some common patterns you'll run into in everyday life. If you find those patterns, draw them on a piece of paper (or your editor of choice, you could do it with mspaint if you wanna). Then you can write out your HTML/CSS. I typically work back and forth. All the HTML, then I CSS, then more html if needed, then more css. etc.

2) An effective Front-End is one which gets the user where they want to go with as little friction *as possible*. Emphasis on as-possible because, just like asap, it doesn't mean "yesterday" it means, "Please prioritize this task above other tasks". An effective FE has a clear idea of purpose and wastes no time achieving those goals. Also, see patterns above. This might not be useful yet but one pattern is to look at the shape of what you're trying to display and allow that to dictate the FE. As an example - almost all documentation sites have a left (or right, or floating) vertical navigation, it takes up maybe 10% of screen width, and then the content of that documentation fill the rest of the width with some amount of padding on the left and right. Consider flipping this pattern. Make the Nav horizontal and the documentation full width to get a feel for why most documentation looks the way it does.

2.1) Some terms to search, "Elements of Art and Principles of Design". I recommend everyone look them up - there are ~20 ideas that reference how we go about making something aesthetic.( Art - color, form, line, shape, space, texture, and value ; Design contrast, balance, emphasis, proportion, hierarchy, repetition, rhythm, pattern, white space, movement, variety, and unity )

3) Uh this is a bit more complicated than I can do in a single comment but maybe we can share discord names if you like the cut of my jib so far.

Re: Why Tailwind CSS Won

#428
post #140

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_,…

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

#429
post #374

Earlier quoted context omitted.

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, sp…

>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...

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

#430

Earlier quoted context omitted.

> And for those that prefer a different editor? A plugin is likely available for that, too. I use PHPStorm a lot; https://www.jetbrains.com/help/phpstorm/tailwind-css.html Panic's Nova? https://extensions.panic.com/extensions/jasonplatts/jasonpla... Vim? https://vimawesome.com/plugin/coc-tailwindcss etc.

If I made a hammer but you need a special glove to use it proficiently, then I didn’t make a very good hammer

Someone who uses a hammer all day may very well decide to use gloves - you'll see a lot of them on construction sites - and they'll probably also opt for a hard hat and safety glasses. Consider these their plugins.
Post reply on HN