Skip to main content
Ajay Sonkar
Back to Blog
By Ajay Sonkar

Mastering Tailwind CSS

Utility classes for the win.

Utility-first CSS gets criticised for making markup look noisy, but on a project that grows past a handful of components it is the thing that keeps the design consistent. Instead of inventing a class name for every variation, you compose the design from a shared vocabulary.

Consistency comes from constraints

A fixed spacing scale, a fixed colour palette and a fixed set of font sizes mean two sections built weeks apart still look like they belong together. There is no drifting from padding: 22px in one file to padding: 24px in another.

Extract components, not classes

The escape hatch is not a long @apply rule — it is a component. When five buttons share the same utilities, make a Button component. The utilities stay local and the repeated combination lives in one place.

Keep the design tokens honest

Define your brand colours and spacing once in the theme, then use the generated utilities everywhere. A change to the brand colour becomes a one-line edit rather than a search-and-replace across the codebase.

WhatsApp