3 ms·
CSS as a language is different from the style attributes that you can insert into `style=`, mainly because it's a lot more powerful. You can do things like set
by MrJohz 2y ago
CSS as a language is different from the style attributes that you can insert into `style=`, mainly because it's a lot more powerful. You can do things like set a background colour on hover, or apply a style only to the first child element of a parent. None of that is possible with the style attribute.
This is also the key difference between conventional CSS classes and Tailwind - it acts less like a set of predetermined classes, and more like a DSL for directly writing CSS inline in the "class" attribute. The result is arguably less reasonable than directly writing CSS, but on the other hand, it's a lot less boilerplate.
In my experience, it really clicks if you write a lot of components, in which case you've already got a way to reuse your code, and so tailwind fits in really nicely with that. If you're mainly writing whole-page styling, then Tailwind usually results in a lot of repetition and doesn't produce much better results than writing everything in CSS in the first place.