4 ms·
There's a few major benefits with Utility CSS. 1. You don't have a dependency on raw CSS which is inherently nested and globally changeable. Instead you depend
by gitgud 6y ago
There's a few major benefits with Utility CSS.
1. You don't have a dependency on raw CSS which is inherently nested and globally changeable. Instead you depend on tailwind.css and all your HTML describes the styling. This also means you can reliably copy chunks of HTML with tailwind classes.
2. Composition over inheritance. CSS is based around the idea of classes and selectors inheriting each other, which makes the style brittle and hard to follow and copy. Tailwind is composed of completely separate classes, which don't affect each other.
3. You actually learn CSS!! Other frameworks like bootstrap hide a lot of CSS features behind classes intended to simplify development. But this actually obscures what's going on with the CSS. Tailwind actually helps you understand how CSS works by having them easily accessible by utility classes.
class="flex flex-col"
Is the same as
style="display: flex; flex-direction: column;"
So you learn how to write better raw CSS too!