Tailwind CSS is a utility-first CSS framework that has changed the way developers style modern websites. Instead of writing custom CSS files full of class definitions, you compose designs directly in your HTML using small, single-purpose utility classes such as flex, pt-4, text-center, and bg-blue-500. In this first lesson you will learn what utility-first CSS means, why Tailwind became so popular, and how it compares to traditional CSS and frameworks like Bootstrap.
In traditional CSS, you invent a class name like .card, then write a block of rules for it in a stylesheet. With utility-first CSS, the framework ships thousands of tiny classes that each do exactly one thing. You build components by combining them:
<div class="rounded-lg bg-white p-6 shadow-md">
<h2 class="text-xl font-bold text-gray-900">Hello Tailwind</h2>
<p class="mt-2 text-gray-600">Styled entirely with utility classes.</p>
</div>Here rounded-lg adds a border radius, p-6 adds padding, shadow-md adds a drop shadow, and text-xl sets the font size. Every class name tells you exactly what it does, so you can read the design straight from the markup.
.card-inner-wrapper-2 again.With plain CSS, styles live far away from the markup they affect, and over time stylesheets grow because developers are afraid to delete rules that might be used somewhere. Tailwind inverts this: styles are local to the element, so there is nothing global to break. You trade slightly longer class attributes for a codebase that is far easier to reason about.
Frameworks like Bootstrap give you prebuilt components (buttons, navbars, modals) with a distinct look. Tailwind gives you low-level building blocks instead. That means a little more work up front, but your site will not look like every other Bootstrap site, and you are never fighting framework overrides to customize a component.
This button is built purely from utilities:
<button class="rounded-full bg-indigo-600 px-5 py-2 font-semibold text-white hover:bg-indigo-700">
Get Started
</button>It has rounded corners, indigo background, horizontal and vertical padding, semibold white text, and a darker background on hover. No stylesheet required.
A common first reaction is that long class lists look messy. In practice, modern development is component-based: you write the class list once inside a React, Vue, or template component and reuse the component everywhere. Tailwind also offers the @apply directive to extract repeated patterns, which we cover in a later lesson.
Next up: Installing and Setting Up Tailwind, where you will add Tailwind to a real project and write your first utility-styled page.