r/programming • u/Either_Collection349 • Aug 02 '26
[ Removed by moderator ]
/r/programming/comments/1vdf6j8/removed_by_moderator/[removed] — view removed post
24
u/AvidCoco Aug 02 '26
> You have to learn dozens of classes
Literally dozens.
Also no you don’t - you look up the documentation when you need something specific.
12
u/notmsndotcom Aug 02 '26
And learning the classes is actually just learning CSS and basically hyphenating them. It’s not like they randomly made up class names lol
0
u/Ross-Esmond Aug 02 '26
Not really though. I have this problem with Tailwind as well. The translation is really inconsistent. Tailwind has classnames that are property-value, value-property, value, or something entirely new. Ironically, this is harder to remember than if it had new names for everything.
If everything was just property-value it wouldn't be as bad. I think they made a huge mistake trying to be more clever than that though.
2
u/deliciousleopard Aug 02 '26 edited Aug 02 '26
It’s even easier than that! If I know the CSS property I’m looking for I usually just use Intellisense. The only time I even bother reaching for the docs is for figuring out how to do custom grid values since those properties are spread over a bunch of utilities.
Edit: to whomever is downvoting, would you mind sharing your thoughts on intellisense vs using the docs?
1
u/BarryCarlyon Aug 02 '26
Or whatever autocomplete/plugin you have in your text editor to hint at classes, then it's just knowing the prefixes
4
10
u/DaStone Aug 02 '26
> Vanilla CSS is self-explanatory, whereas with Tailwind you have to check the documentation.
CSS is not self-explanatory. It has many oddities the same way tailwind does. This seems like a trash article.
7
u/Potatopika Aug 02 '26
Imagine saying that margin: 0 auto is self explanatory to vertically center a div
7
u/NeuralFantasy Aug 02 '26
Ok.
Yet another post about someone getting upset when they can't write Tailwind without first learning it. And someone wanting to write conflicting classes for their components and wanting to resort to css proximity rule. Etc. We have read this N times already.
3
u/EliSka93 Aug 02 '26
getting upset when they can't write _____ without first learning it.
The sickness of the AI generation. I only see this getting worse.
6
4
u/farnoy Aug 02 '26
Let me rename them looking for coherence: flex-align-items-center, flex-justify-content-center, text-align-center, and grid-place-items-center. Do you notice the difference?
Yes, but the CSS properties themselves are not designed coherently. Some of these work with flex & grid both, others only apply to one IIRC. justify-items has recently gained support for block layout, which your recommendation missed just then! It's not so trivial to design a coherent abstraction over an ever-shifting foundation.
What wins is decided by the order in which Tailwind generates those classes in the final stylesheet, not the order in which you write them in the HTML. The markup lies to you. [...] You are left with !important or with avoiding conflicting utilities. This is what is called a leaky abstraction
There is a solution if you're willing to pay the runtime cost - tailwind-merge. I think this issue is still unsolvable when you mix descendant selectors with classes on those descendants. For example, *:bg-blue on the parent and bg-red on the child are on equal footing.
Overall, I don't think you made a good case for separation. Some people just prefer to have a semi-standard set of classes and be able to author style along in the markup. You seem to approach the traditional separation of markup & style as some unquestionable dogma. I disagree with that and enjoy the merged markup more. Not having to look up what classes mean on every project or which file they are even defined in, consistent @layer structure (once you're familiar with specificity as it applies to Tailwind). All of these are things you learn once and then apply on all your projects.
But in a server-rendered project, with templates and classic CSS, the separation still makes complete sense. It is not a universal law, it is a decision that depends on your architecture.
BTW, was this written by an LLM? I don't even mind the "it's not X, it's Y" style, but I wish you asked it to steelman the Tailwind approach and what it means for authoring large codebases with transferability between them.
2
u/lanerdofchristian Aug 03 '26
There is a solution if you're willing to pay the runtime cost
Another solution is leveraging nested
@layer-- if you've got@layer theme, base, components, utilities.components, utilities;in your theme file, you can use an[@layer_components]:variant or@custom-variant component (@layer components);andcomponent:to drop the precedence of specific rules. It's not perfect, since a[@layer_components]:text-red-600andtext-red-600class will generate two definitions instead of one, but you can skip the extra runtime dependency if you only need a few simple cases.
2
2
1
0
0
1
-1
-1
0
u/FlintFlintar Aug 02 '26
Til this day i still dont get why i would want to seperate css from the html. Especially when we try to make stuff as components.
In an agile world, with bugs that need to be fixed weekly. And new features shipped month. The ability to go in and change a component freely and in isolation is amazing.
2
u/chucker23n Aug 02 '26
Til this day i still dont get why i would want to seperate css from the html.
Write some XAML, and you'll see why separating styling from markup has benefits.
3
1
u/DaStone Aug 02 '26
I don't want the interns being able to fuck up every single component when we have a unified design language.
2
u/leaving_the_tevah Aug 02 '26
Ok but css classes are not help maintaining a unified design language. Tailwind does not make your situation any worse.
-10
u/lonelyroom-eklaghor Aug 02 '26
Thanks, I really wanted this one. Tailwind feels like a pain in the arse and I would gladly accept anything simpler
0
u/sisyphus Aug 02 '26
People who write these articles tend to be good at CSS and say things like 'just use modern CSS!' I am not good at CSS, I don't know modern CSS and I don't want to, I want to use the tailwind ui components and that's made me learn some tailwind to customize a few things.
Which is to say, he could be right about every single point but I'm still gonna use tailwind because I don't care about those things.
1
u/HappyAngrySquid Aug 02 '26
I’m pretty good at CSS, and I still prefer tailwind. You get locality of reasoning, sane defaults, no longer have to worry about naming a million things and accidentally conflicting with another name due to CSS essentially being a big global namespace. Tailwind is just better.
0
32
Aug 02 '26
[removed] — view removed comment
3
u/farnoy Aug 02 '26
It's arguably confusing in every place it diverges from CSS naming. Like
text-balance text-inherit text-baseare three different properties. Personally, I'd prefer longer names that are fully consistent with CSS if they map to 1 property.0
Aug 02 '26
[deleted]
-3
u/wrillo Aug 02 '26
I don't want to put words in anyone's mouth, but if that is a true thought then it represents a misunderstanding of the Cascaded Style Sheet paradigm.
LLMs are being coming another later of abstraction, which promotes obscurity of the fundamentals of computer science.
•
u/programming-ModTeam Aug 03 '26
No content written mostly by an LLM. If you don't want to write it, we don't want to read it.