Switching from Simple CSS to Tailwind CSS


As developers, we all know how painful writing CSS can be. Too many selectors, too many lines of code, sometimes just for styling a single element. I felt the same.
That’s when I moved to Tailwind CSS. Tailwind CSS is a utility-first CSS framework. It makes building modern and responsive websites much easier using small, reusable CSS classes.
Why I Switched
I was already working in React with CSS3. But when the components started getting bigger and more complex, CSS quickly became messy:
Multiple CSS files for different components.
Searching for selectors in HTML/JSX.
Writing the same CSS lines again and again.
Even with simple HTML, styling with CSS was boring and repetitive.
Then I discovered Tailwind CSS. Instead of writing CSS for everything, you just add pre-defined classes to your element. Tailwind takes care of the CSS for you.
Example: Styling a Button
With CSS3
<button class="btn">Click</button>
.btn {
background-color: blue;
color: white;
padding: 4px;
border-radius: 100px;
}
With Tailwind CSS
<button class="bg-blue-500 text-white p-2 rounded-full">
Click
</button>
Look how much simpler that is.
But Do You Need to Remember All These Classes?
No! That was my first worry too.
Tailwind’s documentation is amazing. You just need to check the documentation whenever you need to find a new or unfamiliar class. For example, if you search border-radius, it will show you rounded classes. The docs relate everything back to CSS3, so you don’t feel lost.
And honestly, after using a class once or twice, you’ll remember it.
Responsive Design Made Easy
One of the biggest benefits of Tailwind is responsiveness.
If you’ve ever added responsiveness using CSS3 media queries, you know how tiring it can be. But Tailwind makes it super simple.
With CSS3
<h1 class="heading">Responsive Heading</h1>
.heading {
font-size: 1.25rem;
}
@media (min-width: 768px) {
.heading {
font-size: 1.875rem;
}
}
@media (min-width: 1024px) {
.heading {
font-size: 2.25rem;
}
}
With Tailwind CSS
<h1 class="text-xl sm:text-2xl md:text-3xl lg:text-4xl">
Responsive Heading
</h1>
That’s it, One line. The heading grows smaller on tablet and bigger on desktop automatically.
Final Thoughts
Switching from simple CSS to Tailwind CSS has made my life as a developer much easier. It saves time, keeps code cleaner, and makes adding responsiveness a breeze.
If you’re tired of writing the same CSS again and again, give Tailwind a try. Once you use it, you may never want to go back.
Subscribe to my newsletter
Read articles from Zeeshan Ahmad directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Zeeshan Ahmad
Zeeshan Ahmad
Front End Developer Software Engg. at @uettaxila, Pakistan