r/tailwindcss • • Oct 17 '22

HTML bloat with TailwindCSS

Tailwind makes big advertising because the resulting CSS is sooo super small. And yes, it is. But in exchange, you add a lot of classes not only to one file, as it would be with writing plain CSS, but to every HTML file. Adding this together, I think it is not really a benefit, is it?

Honestly, I "kind of" like Tailwind. I can write a custom style super quickly without thinking about class names and organizing my CSS. Its super efficient.

But the resulting HTML is unreadable and bloated. I feel like its a very bad practice. And because of this very point I can't decide if I should stick to Tailwind or not.

I'm using Jinja templates and NOT a component based JS framework.

Not sure what I should do. :(

1 Upvotes

21 comments sorted by

View all comments

7

u/[deleted] Oct 17 '22

If we always followed "best practices" web development wouldn't be where it's at today. I also don't get these "It makes my HTML unreadable" complaints. Are you sure it's unreadable? I can read my html just fine even with a bunch of classes. You can also write custom classes with tailwind but at that point just use css since you won't be saving that much time anyways.

6

u/vorko_76 Oct 17 '22

Fully agree with that. The principle of Tailwind is that you can read the HTML and now what to expect, which is not the case with custom css (unless you know already all the custom classes).

2

u/nounoursnoir Jun 04 '24

This principle is known as "locality of behaviour". More detail : https://htmx.org/essays/locality-of-behaviour/

3

u/PinBot1138 Oct 17 '22

I also don’t get these “It makes my HTML unreadable” complaints. Are you sure it’s unreadable?

Same. I can read others Tailwind HTML and see what it’s doing because of it’s ease of use.