| ▲ | Moving away from Tailwind, and learning to structure my CSS(jvns.ca) |
| 191 points by mpweiher 8 hours ago | 111 comments |
| |
|
| ▲ | TonyAlicea10 3 hours ago | parent | next [-] |
| > I got curious about what writing more semantic HTML would feel like. I've been teaching semantic HTML / accessible markup for a long time, and have worked extensively on sites and apps designed for screen readers. The biggest problem with Tailwind is that it inverts the order that you should be thinking about HTML and CSS. HTML is marking up the meaning of the document. You should start there. Then style with CSS. If you need extra elements for styling at that point, you might use a div or span (but you should ask yourself if there's something better first). Tailwind instead pushes the dev into a CSS-first approach. You think about the Tailwind classes you want, and then throw yet-another-div into the DOM just to have an element to hang your classes on. Tailwind makes you worse as a web developer from a skill standpoint, since part of your skill should be to produce future-proof readable HTML and CSS that it usable by all users and generally matches the HTML and CSS specs. But devs haven't cared about that for years, so it makes sense that Tailwind got so popular. It solved the "I'm building React components" approach to HTML and CSS authoring and codified div soup as a desirable outcome. Tailwind clearly never cared about any of this. The opening example on Tailwind's website is nothing but divs and spans. It's proven to be a terrible education for new developers, and has contributed to the div soup that LLMs will output unless nudged and begged to do otherwise. |
| |
| ▲ | danaw an hour ago | parent | next [-] | | you're unfairly conflating things and putting the blame for a lack of care or understanding on tailwind vs on the dev themselves. nothing about tailwind forces you to build inaccessible or "div soup" apps can tailwind be used poorly? absolutely. but that's true of any tool i've been writing CSS for ~20 years and am quite capable with it, having used CSS, Less, SASS/SCSS, Stylus, PostCSS etc. the reason i have settled on Tailwind for the last few years is precisely because it enables me to build more robust application styling. tailwind frees you from having to spend excessive time building abstractions of styles/classes that will invariably change. placing the styles directly into the markup that is affected by it reduces cognitive load, prevents excessively loose selectors affecting styles unintentionally and really aids in debugging. jumping into codebases with bespoke css frameworks is always more complex and fragile than a tailwind codebase for anything but the most simple sites/apps add to that the ability to have consistent type, color and sizing scales, reduced bundle sizes, consistency for any developer who knows tailwind and a very robust ecosystem (and thus llms are very familiar with it) and tailwind is a really excellent choice for a lot of teams tailwind is like most tools; it can be used well or poorly depending on who is using it | | |
| ▲ | TonyAlicea10 35 minutes ago | parent | next [-] | | If a tool’s design makes it easy to cut myself, the response is not “people have been cutting themselves for years”. There is such a thing as the ergonomics of the tool. Yes div soup has been around a long time. But also yes, Tailwind makes the wrong approach the easy one. It’s ergonomics encourage adding div elements to support styles. It’s the core design loop. You’re conflating “forces to” and “ergonomically encouraged”. | | |
| ▲ | solumunus 11 minutes ago | parent [-] | | It’s just the most effective approach, in my opinion. If it’s wrong then I don’t want to be right. |
| |
| ▲ | ghurtado 21 minutes ago | parent | prev | next [-] | | > can tailwind be used poorly? absolutely. but that's true of any tool Can tailwind be a useful CSS framework? Absolutely, but that can be said of any of them. Which is precisely why it makes sense to point out it's unique flaws, so that people can make an informed decision as to what works best for them. If you have some unique feature to tailwind that you think makes it better than the rest, you should share that. Everything you have listed is also accomplished by all the other CSS frameworks, so it almost sounds like tailwind is simply the main one you have experience with. | |
| ▲ | superfrank an hour ago | parent | prev [-] | | > nothing about tailwind forces you to build inaccessible or "div soup" apps Totally agree. I feel like this was more a by product of React. Not that React forced this either, but it felt like the rise in both went hand in hand for some reason. While I think it's true that none of the current top FE technologies force the div soup, they don't discourage it either. It would be nice if what ever FE technologies catch on next did try to encourage better practices around things like accessibility. Make the path of least semantic HTML the path of least resistance and allow people to fall into the pit of success, ya know? | | |
| ▲ | ghurtado 14 minutes ago | parent | next [-] | | Nothing about programming forces anyone to do anything. That's never been a valid argument to dismiss criticism. It wasn't with Dreamweaver, any it wasn't with visual basic, and it isn't with Tailwind. Patterns matter. Best practices matter. Path of least resistance matters. Those are all choices you make when you develop a CSS framework. Some of those choices are good and some are bad. If none of those things mattered, them choosing a CSS framework would not matter at all. | |
| ▲ | TonyAlicea10 33 minutes ago | parent | prev [-] | | React encouraged this for years by requiring a single parent element being returned from all components. They also showed a div as the option of choice. They fixed this later with Fragments but the damage was done. |
|
| |
| ▲ | flossly 3 hours ago | parent | prev | next [-] | | While I agree I do think there's some "aspiration of purity/correctness" in your approach that I've long let go of. I look at the royal mess that is HTML/CSS/JS as a necessary evil, required when we want to target browsers. To me it's "just the presentation layer". In my work I put a lot more emphasis on correctness in the db schema, or business logic in the backend. When it comes to the messy presentation layer I prefer to write a little as possible, while still ending up with somewhat maintainable code. And for this Tailwind fits the bill really well: LLMs write it very well, new devs understand it quick, and it's quite easy to read-back/adjust the code later. I 100% agree a Tailwind project is not the best way for a new dev to learn HTML/CSS. But then I prefer the new dev to focus on great db schemas, intuitive APIs, test-able biz logic, etc. Fiddling with the mess that's HTML/CSS is not the place where I consider human attention is best spent on (or where developers pick up skills to become much better developers). | | |
| ▲ | TonyAlicea10 3 hours ago | parent [-] | | This isn't about "purity/correctness" it's about the real experience of a blind person. Accessibility means caring about the HTML. Your comment only mentions developers as the audience of HTML authoring, as opposed to users, which is a common attitude and the core problem with Tailwind. | | |
| ▲ | flossly 2 hours ago | parent | next [-] | | I use Tailwind and have all kinds of "screen reader" directives in my templates. Not sure if it helps, but if we get our first blind user I will gladly make some admends to make it more usable for them. It seems that Tailwind is now blamed for the mess that is HTML/CSS. Tailwind certainly allows for accessible designs; it may not be the ideal solution, sure, but what we aim for is "good enough". | | |
| ▲ | embedding-shape 2 hours ago | parent | next [-] | | > but if we get our first blind user I will gladly make some admends to make it more usable for them. Isn't this slightly backwards? Why would blind users sign up if the platform isn't usable for them in the first place? It has to be usable for them for them to become users :) | |
| ▲ | throwaway24274 an hour ago | parent | prev | next [-] | | It's not just blind people, but also people with reduced eyesight. As I'm getting older, I really appreciate good contrast and the possibility to zoom in without breaking the layout. | | |
| ▲ | u_fucking_dork an hour ago | parent [-] | | And how does tailwind or the structure of the underlying html of the page change or affect that? |
| |
| ▲ | TonyAlicea10 26 minutes ago | parent | prev | next [-] | | I mentioned blind but there’s lots of others. Folks sitting a desk whose eyesight are getting worse and are scared to say so for fear of losing their job, for example. This happens. Side note: if you aren’t deliberately choosing semantic elements and instead dropping aria attributes onto a bunch of divs this is an anti-pattern. | |
| ▲ | reaperducer 2 hours ago | parent | prev [-] | | if we get our first blind user I will gladly make some admends to make it more usable for them. Not good enough. You have to be accessible before it is needed in order to avoid legal liability. And how do you expect to get a blind user if they already cannot use your product? None of the doctors I build web sites for are currently blind. I know this because I talk to them regularly. But I still build the web sites for the future, when HR might hire a doctor or nurse or other person who is blind, or partially sighted, or has trouble with their muscles, or has difficulty distinguishing colors. Doing the right thing isn't that hard. Not doing it is just lazy. | | |
| ▲ | flossly 2 hours ago | parent | next [-] | | You call it lazy. I call it "focus" or avoiding pre-mature optimization. I find the "legal liability" claim hilarious... I do better than 95% of the web: as I said I HAVE some screen reader directives (just did not test it), and labels to make the app more accessible. | | |
| ▲ | 48terry 35 minutes ago | parent [-] | | > You call it lazy. I call it "focus" Is this to be read that disabled people and their needs, or more directly from the replied-to comment, "doing the right thing", are not a focus of yours, flossly? | | |
| ▲ | LtWorf 17 minutes ago | parent [-] | | A former coworker of mine opened a meeting saying "we are so good, we care about accessibility". I had been complaining for months and finally a customer had said "we won't buy your product unless it complies to the law". |
|
| |
| ▲ | 0x3f 2 hours ago | parent | prev | next [-] | | Sounds like you're kind of just talking your book though. Person who makes accessible sites suggests you need an accessible site. Blind people aren't the only ones who might need modifications. You could have an infinitely long list of adjustments for all kinds of disabilities, and tell me I'm lazy for not doing each of them. Why are blind people special? | | |
| ▲ | well_ackshually an hour ago | parent [-] | | You are lazy for not doing accessibility adjustments, because accessibility isn't for blind users. It's for the deaf ones, the ones with poor eyesight, the ones with mental deficiencies, the ones with motor issues like Parkinson's, the ones browsing your site shitfaced at 4AM, and so on and so on. Accessibility isn't a checklist to cover your ass for a percentage of the population: it's for everyone. It literally makes your website less shit. You slapping an aria-label doesn't fix things. | | |
| ▲ | 0x3f an hour ago | parent [-] | | Every moment you spend doing accessibility is a moment you spend not doing other things. You could argue it has a high RoI to do accessibility, fine, but that doesn't make it lazy _not_ to do it. Maybe I have even higher RoI/EV stuff to be doing. | | |
| ▲ | 48terry 20 minutes ago | parent | next [-] | | > Maybe I have even higher RoI/EV stuff to be doing. I mean, to readers of these comments, I think it's right there for you: 0x3f will take "higher ROI" over "accommodate and support disabled people". | | |
| ▲ | 0x3f 14 minutes ago | parent [-] | | Yeah, thats explicitly what I'm saying so I'm not sure it needs repeating. That has very little to do with it being lazy though, is the point. We were already implicitly discussing RoI when we were talking about 'legal consequences' above. This is how people decide between alternatives, generally. |
| |
| ▲ | esseph 9 minutes ago | parent | prev | next [-] | | [delayed] | |
| ▲ | well_ackshually an hour ago | parent | prev [-] | | Accessibility is done while you do it. Not as an afterthought. But if you're having a higher ROI writing absolute crap, feel free, it's not my website. | | |
| ▲ | 0x3f 10 minutes ago | parent [-] | | You're just expressing a normative view here, it's not very interesting or informationally-dense. You care about accessibility more than I do. That doesn't make not doing it 'crap'. |
|
|
|
| |
| ▲ | ncphillips an hour ago | parent | prev [-] | | We use tailwind and are capable of building accessible websites without any issue. People could make all the same mistakes with CSS for accessibility. It’s the not knowing how to make accessible content that leads to inaccessible content, not the tool you use to implement the styling. |
|
| |
| ▲ | jbreckmckye an hour ago | parent | prev | next [-] | | What does Tailwind have to do with accessibility? Most significant HTML markup is block level elements. The CSS is completely orthogonal. I feel like old-school frontend devs bring up accessibility as a kind of bogeyman. It reminds me of the myth that CSS style X or Y breaks accessibility "because screen readers expect semantic CSS classes". Zeldman (of A List Apart) promulgated that disinformation for years, until someone actually told him screen readers don't work that way. 90% of people who use a11y as a rhetorical cudgel have never actually used AT themselves. | |
| ▲ | gjsman-1000 an hour ago | parent | prev [-] | | But why would I spend any time mastering this skill when we have AI now? Disability software that uses both the markup and the on-screen visual for decision making is likely imminent and would render most of this no longer necessary. Claude Cowork is already doing navigation and web browsing by screenshot showing this is possible. | | |
|
| |
| ▲ | mhitza 2 hours ago | parent | prev | next [-] | | Using tailwind doesn't lead to any inherent concession of accessibility. How do you come to that conclusion? If I look at their component library, they also do the work of including aria attributes for you https://tailwindcss.com/plus/ui-blocks/marketing/sections/pr... (first exsmple with free code I've found). If we're not talking landing pages, which are more like digital brochures, I always start with markup and then add css classes on top. | |
| ▲ | vehemenz 3 hours ago | parent | prev | next [-] | | A few counterpoints: Treating markup and styles separately is great, in principle, but you'll always need additional markup for certain things. We knew this going back to the early 2000s. There is nothing about Tailwind itself that forces you to use divs and spans instead of the appropriate HTML tag. Documents and interfaces are different. Tailwind makes a lot more sense for interfaces. You can use Tailwind for the interface and scoped HTML selectors for other content. Tailwind is around 4x faster and has practically no overhead compared to writing a complex CSS codebase. Whatever you think of it, this is always a benefit in its corner. | | |
| ▲ | hahn-kev an hour ago | parent | next [-] | | I always feel like the distinction between interference and document is missing in these types of discussions. Often times they're as different as native vs web dev and if you don't realize that then you're arguing about totally different things and nothing will make sense. | |
| ▲ | efortis 2 hours ago | parent | prev | next [-] | | Benchmarks? | |
| ▲ | spiderfarmer 2 hours ago | parent | prev [-] | | As someone who wrote CSS for 20 years and who was against using Tailwind because of “principles” I must say that Tailwind is just awesome. Every minute spent trying to make sense of the structure past you or your colleagues came up with is a minute that could be spent on something more important. Every time someone says that Tailwind sucks, it’s like hearing the old me speak. | | |
| ▲ | ncphillips an hour ago | parent [-] | | Same here. It’s super weird take to me now. Maybe if you’re just writing plain HTML and CSS tailwind would be worse, but assuming there’s a component system you’re going to be just fine. The cascade of CSS is such a foot gun. Localized styles work great and tailwind abstracts away hardcoded values with relative ones |
|
| |
| ▲ | uxcolumbo 2 hours ago | parent | prev | next [-] | | What's a good source to learn how to develop like this - to create HTML / CSS structure that's accessible? EDIT: ignore. I can see you have some links in your profile. Will check it out. | |
| ▲ | BobbyTables2 18 minutes ago | parent | prev | next [-] | | I find your comment quite refreshing. 25 years ago, I was appalled how Microsoft Frontpage could transform a very simple word document (with little formatting) into an utterly indecipherable mess of HTML that rendered correctly. With very simple transformations, I could paste the text of the document into notepad and add just a few heading tags for the same rendered result but a much more understandable source. CSS had a lot of promise for simplifying the HTML content, but the world tried its hardest to prevent that. Now we have multi-megabyte monsters for simple webpages (before even counting graphics). | |
| ▲ | freedomben 3 hours ago | parent | prev | next [-] | | You're not wrong, and I mostly agree with you. I die inside when I see the div soup that a lot of sites have become. However, I think there is value in being able to have the important parts of CSS merged into the HTML a bit. Where that line is, is certainly up for debate (and I don't have the answer), but I've found a lot of my tailwind sites are more readable to me than my pre-tailwind sites, often because I don't have to context-switch and open a different file to be able to reason about the styling on an element. For big stuff the second file can be nice, but there's a lot of style tweaking that is great to be able to do right there in the HTML. Tailwind does really lead you to ignore the css file though (or keep it highly minimal), which I agree is becoming an anti-pattern. | | |
| ▲ | TonyAlicea10 3 hours ago | parent | next [-] | | The "open a different file" reasoning piece is a common pro-Tailwind statement and I do see the upsides. I think that upside became more prevalent in the reusable components era, whereas previously CSS was targeting an entire HTML file (and thus the reasoning was more like SQL query than "this one element's styling"). With LLMs I think this upside is much smaller now though. | |
| ▲ | reaperducer 2 hours ago | parent | prev | next [-] | | I don't have to context-switch and open a different file to be able to reason about the styling on an element Unless you're coding on a VT100 terminal, you just put the HTML in one window and the CSS in another. Subdivide as necessary, or as your monitor space allows. Heck, we were doing that back in 1989 on IBM PCs with MDA displays. If your CSS is so out of control that you can't wrap your brain around it, it's time to refactor or split into individual CSS component files. | | |
| ▲ | afiori an hour ago | parent [-] | | Maybe even split it into a set of small reusable coherent utility classes |
| |
| ▲ | skydhash 3 hours ago | parent | prev [-] | | It seems that everyone is forgetting the web inspector as a tool for designing web pages. You can tweak properties and styles in a live environment, and then transfer your preferences to the css files. |
| |
| ▲ | antran22 2 hours ago | parent | prev | next [-] | | > Tailwind instead pushes the dev into a CSS-first approach. You think about the Tailwind classes you want, and then throw yet-another-div into the DOM just to have an element to hang your classes on. To be fair plopping a `div` everywhere started way before Tailwind. I blame React and the mess that is CSS in JS for this. | | |
| ▲ | evilduck 2 hours ago | parent | next [-] | | Divitis was a thing long before React came along. It was a common solution to styling problems even in the jQuery/Dojo days. Getting stuff to look similar across IE6 and FF before CSS3 relied heavily on divs. | |
| ▲ | ncphillips an hour ago | parent | prev [-] | | It did for sure. And Tailwind absolutely doesn’t need to be done this way. I think this is a correlation-not-causation issue |
| |
| ▲ | reaperducer 2 hours ago | parent | prev | next [-] | | HTML is marking up the meaning of the document. You should start there. Then style with CSS. This is precisely how I do it. Code that generates HTML. Once I can see all the content on the screen in some kind of Netscape Navigator 1.0 nightmare, then I go back and add styles to make it look pretty. It's not hard. It just requires thought and planning. (The best planning tool I've found is a pencil and grid paper, not the web design SaaS-of-the-moment. However, it's surprisingly hard to find good pencil sharpeners these days.) | |
| ▲ | 7bit 2 hours ago | parent | prev | next [-] | | > Tailwind instead pushes the dev into a CSS-first approach. You think about the Tailwind classes you want, and then throw yet-another-div into the DOM just to have an element to hang your classes on. I wholeheartedly disagree. That mindset is not caused by Tailwind, but by being ignorant. You can perfectly create an HTML document with semantic meaning and the add Tailwind just as any other CSS framework or pure CSS to it. And DIVs do not carry meaning, they are specifically to add functionality or styling, so you can throw in as many as you like. Using them abundantly isn't good style, but the way you make it sound that they're evil isn't good either. | |
| ▲ | troupo an hour ago | parent | prev | next [-] | | > HTML is marking up the meaning of the document. You should start there. Then style with CSS. If you need extra elements for styling at that point, you might use a div or span (but you should ask yourself if there's something better first). > Tailwind instead pushes the dev into a CSS-first approach. You're putting the cart before the horse. Or forgetting either the cart or the horse. Tailwind doesn't force anything. And "semantic HTML" or "semantic CSS" are not really a thing, and have as much bearing on how many divs a page has, as Tailwind. And the reason is simple: there's literally nothing else in HTML than divs and spans. The amount of usable primitives is absolutely laughable, and trying to combine them in any useful manner results in as much soup with Tailwind as without Tailwind. > since part of your skill should be to produce future-proof readable HTML and CSS that it usable by all users and generally matches the HTML and CSS specs. Which part of Tailwind isn't readable, isn't future-proof, or doesn't match HTML and CSS specs? How is "px-4" none of that, but ".ytp-big-mode.ytp-cards-teaser-dismissible .ytp-cards-teaser-label" (Youtube's CSS) or ".swg-button-v2-light[disabled]" (Washington Post) or "legacy-popover--arrow-end-bottom:after" (Spotify) are? > The opening example on Tailwind's website is nothing but divs and spans. Oh no! And what are the opening examples on any of the "proper pure-as-god-intended CSS" sites? | |
| ▲ | mgraczyk an hour ago | parent | prev [-] | | CSS is badly designed and uses a confusing, separate DSL with arbitrary rules designed before the Internet was widely used, before web apps existed, before smartphones etc It's trash and throwing it out is good. Not learning it is good. Tailwind is a solution to a real problem. More importantly, AI is good at it already and it's unlikely humans will need to understand HTML/CSS at all within a year or two. There's no reason to spend time learning how the gears work, just put the cover back on | | |
| ▲ | odnckwmxkwdj 43 minutes ago | parent | next [-] | | “CSS is bad”
Why?
“Because reasons.”
Care to explain?
“No need to learn it anymore, my AI can do it for me”
Okay, but why is it bad to learn it
“Reasons” Uh… what? | |
| ▲ | ramesh31 an hour ago | parent | prev [-] | | >It's trash and throwing it out is good. Not learning it is good. Tailwind is a solution to a real problem. Yup. Spent a decade of my career writing CSS every day, I was what you would call a "guru" and have written easily hundreds of thousands of lines of it over the years. Haven't touched a class or a stylesheet in nearly a year now, and probably never will again. Good riddance. |
|
|
|
| ▲ | efortis 28 minutes ago | parent | prev | next [-] |
| CSS Modules are a simpler solution to cascading problems. They create unique class names, so your classes don't clash [1]. And they don't have the two main downsides of TW, which are readability [2] and tooling. Tooling for debugging and experimenting interactively with Chrome and FireFox DevTools. [1] https://x.com/efortis/status/1888304658080256099 [2] https://github.com/ericfortis/tailwind-eye |
|
| ▲ | xrd 39 minutes ago | parent | prev | next [-] |
| I really, really love Julia Evans writing. She writes from a place of vulnerability and honesty. Most people write to sound smart and she writes to say "I don't know it all but there are some things I discovered I want to share." I almost feel like she writes to share things with people she loves, even though she doesn't know them directly. She spoke alongside Randall Munroe at the last Strange Loop (RIP). Some people waited to talk to him afterwards, but I waited to talk to her. I don't think she got my joke that she should rewrite her bash scripts into perl and for that I'm truly sorry. |
|
| ▲ | simonreiff 41 minutes ago | parent | prev | next [-] |
| Nice article! I'm a fan of removing any dependencies on external libraries and writing my own solution from scratch, but there's a good reason why I decided not to do so with Tailwind: They offer an optimization for production that ensures that you never ship more than the bare minimum of CSS needed. This means you can keep your palette of color, spacing, and other options fully enumerated in `globals.css` and elsewhere, without worrying whether you're using all those variants in production. Moreover, if you're working within a framework, such as Next.js, this minimization step automatically happens when you build, without even having to worry about whether it's happening. This alone is a compelling reason, at least for me, not to migrate from Tailwind. Also, I've never found any restrictions in Tailwind in using inline CSS that weren't readily navigable, or in implementing really nice responsive grids that handle different screen widths for instance using Tailwind's grid tooling. I definitely have solved each of the scenarios described in this article using Tailwind or a Tailwind-CSS combination, but it's true that they don't have grid-column-areas natively. Still, I haven't yet found that to be a significant restriction in getting responsive grid layouts. I think the biggest issue with Tailwind is simply that it takes a long time to get used to reading it. We all learn that inline CSS is bad, globally scoped CSS is best, etc., and we get used to seeing clean simple HTML. Then we look at real-world code featuring Tailwind and it just looks so hard to read at first, especially because the lines are so long. I guess I just have been using it long enough that I've gotten completely used to the way it looks, but I do remember it took me a very long time to get comfortable with reading Tailwind. After a long while, I concluded that, for me, Tailwind really is more efficient and maintainable and even more readable, but it definitely took quite a bit. |
|
| ▲ | JimDabell 2 hours ago | parent | prev | next [-] |
| One thing that has always struck me about Tailwind is that practically every argument its proponents use more or less boils down to “I never learnt CSS beyond a junior level”. It’s super common to hear Tailwind advocates say things like “Without Tailwind, we would just have one big disorganised CSS file that always grows uncontrollably and ends up with loads of obsolete stuff in it and !important everywhere! Tailwind is so much better!”. CSS is a skill just like any other technical skill. If all you do is learn the bare minimum so you can bodge things until you get something that looks right, then your ambitions are going to outpace your ability to keep things organised very quickly. |
| |
| ▲ | timr 2 hours ago | parent | next [-] | | It's worse than that; the common arguments for Tailwind literally derive from total ignorance of how CSS is made to work, and a disposal of guidelines that developers would worship in any other context (i.e. Don't Repeat Yourself). It's really frustrating to be talking with someone about Tailwind and CSS, and realize that not only do they not know what "cascading" means, they never even considered the concept might be useful in the context of a stylesheet. | | |
| ▲ | pverheggen 41 minutes ago | parent | next [-] | | Tailwind, JS-in-CSS, and the like have become popular because they work well with the modern corporate UX workflow. A Figma component has a certain set of styles, you apply those same styles to the corresponding React component. And none of this really violates DRY, your unit of reuse has shifted from a CSS class to a framework component. There's nothing precluding you from using an approach like DaisyUI if stock Tailwind has too much repetition for your taste. | | |
| ▲ | timr 33 minutes ago | parent [-] | | > A Figma component has a certain set of styles, you apply those same styles to the corresponding React component. This is what CSS classes were made for. Of all of the arguments in favor of Tailwind, this is the one that drives me battiest. Say what you will about CSS, but "give a name to a re-usable set of styles for a component" is pretty much as fundamental as you can get. > And none of this really violates DRY, your unit of reuse has shifted from a CSS class to a framework component. Sure, sure. except for the inline styles everywhere. And the fact that everything is literally being repeated all over the place. But other than that, no repetition! > There's nothing precluding you from using an approach like DaisyUI if stock Tailwind has too much repetition for your taste. ...and now you have three problems. | | |
| ▲ | 9dev 3 minutes ago | parent [-] | | > This is what CSS classes were made for. That brings with it the problem of naming a thousand things in a consistent way that everyone on your team needs to understand and remember, otherwise you end up with tons of duplicated classes, parallel systems, and bike shedding. Have we, as an industry, not felt this pain often enough yet? Do we really need to keep banging our head against the wall to figure out it does hurt? > Sure, sure. except for the inline styles everywhere. There are no inline styles when using Tailwind. There are references to variables from the design system. > And the fact that everything is literally being repeated all over the place. If you find yourself repeating the same sequence of classes, it's time to create a component in your frontend framework if you use one, or a Tailwind utility class. And even if you just copy-paste the same class strings all over the codebase, transport compression will eliminate that pretty much entirely. |
|
| |
| ▲ | u_fucking_dork an hour ago | parent | prev | next [-] | | The common arguments against Tailwind usually derive from total ignorance of working with CSS on large scale projects with many team members. And when this is pointed out you’ll usually get replies that just hand wave it away as not a problem, as if things like BEM were invented for no reason. | | |
| ▲ | timr an hour ago | parent [-] | | Yeah, that's a straw-man. I've worked on large-scale projects with many team members, and it's perfectly possible to use CSS as it was designed. But sure, like most tools, it starts with understanding how it works. | | |
| ▲ | 9dev a minute ago | parent | next [-] | | Sure it's possible, but is it possible for everyone on your team? Including the new hire, the interns, or the now-vibecoding managers? Sooner or later it deteriorates. | |
| ▲ | pverheggen 34 minutes ago | parent | prev [-] | | Sure, but "total ignorance of how CSS is made to work" is also a straw man. |
|
| |
| ▲ | coolThingsFirst an hour ago | parent | prev [-] | | And the cascading thing is a nightmare even after years. Whenever i have written CSS/TailwindCSS which was unproblematic to extend it was when i literally switch thinking to use least amount of properties and let the page flow. Whenever i see tons of css i know it’s brittle and will cause hours of wasted time down the line to fix something which already should have been fixed. |
| |
| ▲ | romanhn 9 minutes ago | parent | prev | next [-] | | The more experienced Tailwind proponents probably have better things to do than get dragged into yet another online flamewar :) I've done tons of CSS since the 90s before looking into Tailwind. After it clicked, I've mostly tried to avoid raw CSS. In a sense, you exchange one mess for another. Personally, I'd rather deal with a localized class soup than trying to make sense of overlapping, often contradictory, cascades of styles across multiple files. Both can be implemented cleanly, but I'd much rather clean up a Tailwind mess than a CSS one. And I find the development process much more enjoyable overall. | |
| ▲ | chistev 2 hours ago | parent | prev | next [-] | | Isn't Tailwind easy to understand when you look at the codebase, rather than putting in more effort to learn a pure CSS codebase? Isn't that part of the argument of Tailwind being easier to scale? | | |
| ▲ | JimDabell 2 hours ago | parent | next [-] | | > Isn't Tailwind easy to understand when you look at the codebase, rather than putting in more effort to learn a pure CSS codebase? No, I don’t think that’s the case at all. | |
| ▲ | reaperducer 2 hours ago | parent | prev [-] | | Isn't that part of the argument of Tailwind being easier to scale? I think that was true at the beginning. But Tailwind is quickly approaching the multi-headed hydra it was trying to replace. | | |
| ▲ | 9dev 12 minutes ago | parent [-] | | What exactly has changed about Tailwind in, like, years? There are a few more properties for new CSS features, a few convenience features (like size-x instead of w-x h-x for the same values of x), but other than that? If you've grown accustomed to the utility classes eight years ago, then disappeared under a rock until today, you should be able to continue working in an unrelated, Tailwind-using project immediately. |
|
| |
| ▲ | chaosharmonic 42 minutes ago | parent | prev | next [-] | | Personally, I'm not sure from my own dives into it that I'd still insist on bare CSS in a professional codebase any more than I'd insist on plain DOM manipulation. And I do at least see Tailwind classes as being a little less of a DSL than other, similar tools. But while I'm not going to be a purist about it at a workplace, I both agree with you and have noticed a layer even beyond your point: that overreliance on these things leads to not learning HTML beyond a junior level. It gets really easy to lean on class-based CSS and use a `<div>` for everything instead of ever learning what a semantic element is. And that contributes to other bad habits, like writing a bunch of JavaScript to define behavior that could just be natively handled by your browser. A weird personal irony is that because no employer has ever asked me to directly write CSS, what's actually made me better at CSS is JavaScript -- namely that my understanding of selector logic has improved a lot after picking up Web scraping. | |
| ▲ | bdcravens 2 hours ago | parent | prev | next [-] | | Isn't the same true of those who use a library that wraps SQL? | | |
| ▲ | chaosharmonic 38 minutes ago | parent [-] | | I would think manipulating CSS through user input is both less common as an application pattern and less critical as an attack surface. |
| |
| ▲ | throwawaysleep an hour ago | parent | prev [-] | | That’s the value of tailwind. You can just skip learning CSS and still get a good result. The benefit to learning it is marginal. |
|
|
| ▲ | bryanhogan 2 hours ago | parent | prev | next [-] |
| I have been writing a "clean" web development guide focusing on writing HTML and CSS that scales well: https://webdev.bryanhogan.com/ Maybe it's useful for people here. I don't use Tailwind or similar for styling, just CSS with modern frameworks like Astro or Svelte. For every project I have the following CSS files: - reset.css - var.css - global.css - util.css Other styling is scoped to that specific component or layout. |
| |
| ▲ | aejm 2 hours ago | parent [-] | | Using a JavaScript framework kind of defeats the whole purpose doesn’t it? | | |
| ▲ | hstaab an hour ago | parent [-] | | css modules with react are really nice to work with. Plain css scoped to a component. The two arnt always at odds |
|
|
|
| ▲ | bumbledraven 4 minutes ago | parent | prev | next [-] |
| TFA links to https://joshcollinsworth.com/blog/tailwind-is-smart-steering, which is about Tailwind, but makes multiple distinctions and points that could just as well apply to LLMs, e.g.: > Builders value getting the work done as quickly and efficiently as possible. They are making something—likely something with parts beyond the frontend—and are often eager to see it through to completion. This means Builders may prize that initial execution over other long-term factors. > Crafters are more likely to value long-term factors like ease of maintainability, legibility, and accessibility, and may not consider the project finished until those have also been accounted for. > In my view, the more you optimize for building quickly, the more you optimize for homogeneity. |
|
| ▲ | KolmogorovComp 3 hours ago | parent | prev | next [-] |
| For me Svelte and LLM completely removed my need for Tailwind. Turns out I was using it primarily to avoid CSS collision, and (to me) more logical syntax, rather than the self-imposed constraints. |
| |
|
| ▲ | pjmlp 3 hours ago | parent | prev | next [-] |
| Tailwind crazy adoption is something that makes me happy to nowadays be doing mainly boring stuff in distributed cloud systems and agents, instead of WebUIs. |
|
| ▲ | Alifatisk an hour ago | parent | prev | next [-] |
| Oh, have we reached the end of the pendulum swing and are now swinging back to ordinary CSS again. |
|
| ▲ | neya 2 hours ago | parent | prev | next [-] |
| So, we're just going a full circle back now. Interesting. |
| |
| ▲ | eYrKEC2 an hour ago | parent | next [-] | | _tailwind_ was the full circle. We had individual controls. We went to semantic controls, then back to individual controls a la tailwind. | |
| ▲ | 4lx87 2 hours ago | parent | prev [-] | | Hope so. I’d like to be able to read the HTML templates again. |
|
|
| ▲ | grzes an hour ago | parent | prev | next [-] |
| tailwind is an anti-pattern that breaks separation of concerns rule. i'm amazed how it became so popular. |
|
| ▲ | iovrthoughtthis 35 minutes ago | parent | prev | next [-] |
| html encodes a tree of objects css applies attributes to objects via graph queries the queries are tightly coupled to the tree. you must work hard to avoid scatter gun edits now. it doesn't make much sense to have attributes stores in a separate location to their use it would be like assigning all of your instances attributes using decorators |
|
| ▲ | Polarity an hour ago | parent | prev | next [-] |
| oh is this stupid hype of defining design in html with a random framework finally over? thank god! |
|
| ▲ | firatsarlar an hour ago | parent | prev | next [-] |
| A life framework, consensus, that how the man face the thing that they crafting. |
|
| ▲ | raincole an hour ago | parent | prev | next [-] |
| I think the (misuse of) so-called "separation of concerns" has been the most harmful thing that happened in web front end development. HTML can CSS are the same kind of concerns: the presentation layer. The idea that HTML is purely semantic and has nothing to do with presentation is just burying the head in the sand. Separating HTML and CSS into different files is just like separating a bunch of methods/functions into different files, or splitting one monorepo into git submodules. Yeah, it sometimes makes sense, but if you're doing it for the sake of separating things then just stop. I think the only point of Tailwind is to make front end devs realizing how much separation of concerns is misunderstood and misused as a dogma. Once you realize that you can ditch Tailwind if you like. |
| |
|
| ▲ | agus4nas an hour ago | parent | prev | next [-] |
| Curious if you noticed any performance differences after switching — did bundle size or load times change at all? |
|
| ▲ | stephbook 3 hours ago | parent | prev | next [-] |
| I'm lucky to have learned the web with Angular 2.x It scopes CSS to components by default, and keeps HTML, CSS and JavaScript seperate. |
| |
| ▲ | CharlieDigital 2 hours ago | parent [-] | | Vue single-file components (SFC[0]) still works this way. <template>
<!-- Largely just HTML -->
</template>
<script setup lang="ts">
// JS/TS as you would expect
</script>
<style scoped>
/* Component scoped styles here */
</style>
Very clean, easy to understand, and (as someone who started hand writing DHTML) it still feels very much like DHTML with more convenience and modern affordances.[0] Vue SFC docs: https://vuejs.org/guide/scaling-up/sfc.html |
|
|
| ▲ | zamalek an hour ago | parent | prev | next [-] |
| What I don't get about tailwind is: why not just use the style attribute at the point? |
| |
| ▲ | 0x3f an hour ago | parent [-] | | It's much more verbose and can't do everything Tailwind can anyway. E.g. how do you style a child on parent hover with the style attribute? |
|
|
| ▲ | NetOpWibby 2 hours ago | parent | prev | next [-] |
| Nature is healing |
|
| ▲ | BoredPositron 3 hours ago | parent | prev | next [-] |
| I am so happy that the only time I have to touch css anymore is for simple internal tools and pico is usually enough for them. |
|
| ▲ | hit8run 2 hours ago | parent | prev | next [-] |
| Thats why I maintain the successor to tachyons: https://tachyonsneo.com
No build pipeline. Resort to CSS when utilites make no sense.
No lock in. |
| |
| ▲ | keybits 2 hours ago | parent [-] | | Can you clarify how this relates to Tachyons - do all Tachyons features work? Or is it a subset of Tachyons? |
|
|
| ▲ | villgax 3 hours ago | parent | prev [-] |
| Relying on React or Typscript in LLM era seems very stupid, just have the LLM setup whatever dom manipulation you want and have it write decent JS without slop. Far more offline compatible development almost negligible supply chain issues as well. At least ones you can control. |
| |
| ▲ | jfengel 2 hours ago | parent | next [-] | | Layout design issues are orthogonal to choice of language and framework. You can apply the article's approach to plain static pages and to SPAs. I tend to work closer to the latter end and find that both React and Typescript are extremely helpful to make my code extensible and maintainable. YMMV. | |
| ▲ | dwb 2 hours ago | parent | prev | next [-] | | This makes no sense. LLMs and agents benefit from (good) abstraction as much as humans do. | |
| ▲ | freedomben 3 hours ago | parent | prev | next [-] | | This works great for small sites/apps, but really starts to fall apart if/when it gains complexity where React starts to make sense. I've tried a few times to "just use plain javascript" with the LLM and initial results are often much better, but if the site grows a bit too complex, the LLM starts making a lot of mistakes and it can be hard to reason about as a human and get it on the right track. That hasn't been the case with the React apps IME. | |
| ▲ | bel8 an hour ago | parent | prev | next [-] | | React maybe (because there are alternatives). But for mid/large projects, I find that TypeScript brings sanity to JavaScript. I love some quick and dirty JS project. But after a certain project size I begin the see runtime errors like undefined, NaN, 'false/true' concatedted to URLs, and so on. TypeScript eliminates a ton of those. | |
| ▲ | wakamoleguy 3 hours ago | parent | prev | next [-] | | What a strange take. LLMs produce plausibly correct output, which is exactly where plain JavaScript and DOM manipulation will result in a spaghetti mess. Frameworks like React that add structure to the data flow, component encapsulation, and a huge repertoire of patterns to train on, plus Typescript for immediate compile-time feedback loops… those are what LLMs thrive on. | |
| ▲ | thekingshorses 3 hours ago | parent | prev | next [-] | | I agree, specially for simple apps. it's much easier to upgrade if you are not relying on 3rd party or NPM's. Don't have to worry about code injections. I have these two https://reddit.premii.com and https://hn.premii.com/ both works without any changes. Reddit will stop working once they kill the apis but until then it will work. | |
| ▲ | 48terry 29 minutes ago | parent | prev | next [-] | | > just have the LLM setup whatever dom manipulation you want and have it write decent JS without slop. Hmm, yes, simply have the LLM write good with no mistakes. | |
| ▲ | cleaning an hour ago | parent | prev [-] | | I hope I never have to work with you. |
|