What is utility-first CSS and what are its benefits?
Utility-first means composing small, single-purpose classes directly in markup instead of writing semantic class names and separate stylesheets. In Tailwind, a class list describes the result without inventing names.
<button class="rounded bg-blue-600 px-4 py-2 text-white hover:bg-blue-700">Save</button>
Benefits: no naming debates, no unused CSS accumulating, styling colocated with markup so deleting a component removes its styles, and design-system constraints on spacing, colour and type that produce visual consistency. Responsive and state variants become trivial through prefixes.
Trade-offs: markup is verbose and long class strings can be hard to scan, though extracting components solves that better than @apply. Teams new to it often overuse @apply and recreate the same bespoke stylesheet problem. The approach works best with a component-driven UI where repetition is encapsulated in components rather than CSS classes.