This content originally appeared on DEV Community and was authored by Kaif Zaki
When building modern UIs, developers often face a choice: write custom CSS or use a framework. Tailwind CSS takes a different approach β itβs a utility-first CSS framework that gives you small, reusable classes to style your components directly in your HTML/JSX.
What Does βUtility-Firstβ Mean?
In traditional CSS frameworks (like Bootstrap), you get pre-designed components. Tailwind instead provides low-level utility classes that you can combine to build custom designs.
For example, instead of writing this:
/* custom CSS */
.btn {
background-color: #3b82f6;
color: white;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
}
And then using it like:
Click Me
With Tailwind, you can do it directly:
Click Me
No separate CSS file required .
Benefits of the Utility-First Approach
Speed β You style as you go, no switching between HTML and CSS.
Consistency β Classes are standardized (e.g., px-4, text-lg).
Customization β You can extend colors, spacing, and themes easily.
Responsive by Default β Mobile-first classes like md:, lg: make it simple.
Example:
Responsive Box
This box changes padding and font size based on screen width.
A Real Example with React + Tailwind
export default function Card() {
return (
Tailwind Card
This card is styled entirely with Tailwindβs utility classes. No custom
CSS needed.
Learn More
);
}
Clean, reusable, and fully responsive.
Customizing Tailwind
Tailwind is not just utilities β you can customize it in tailwind.config.js:
export default {
theme: {
extend: {
colors: {
brand: “#4ade80”, // your brand green
},
},
},
};
Then use it like:
Brand Button
Final Thoughts
Tailwind CSS shifts the way we think about styling:
Instead of writing new CSS for each component, you compose with utilities.
Itβs faster, more consistent, and scalable for modern apps.
If you havenβt tried it yet, spin up a project with Vite + Tailwind and see how quickly you can build beautiful UIs.
Do you prefer utility-first (Tailwind) or component-first (like Bootstrap/Material UI)? Drop your thoughts in the comments!
This content originally appeared on DEV Community and was authored by Kaif Zaki