completefrontend

Should you use Tailwind CSS or plain CSS?

Tailwind CSS styles elements with small utility classes in your HTML, while plain CSS uses your own rules in a stylesheet. Here's the same button written both ways, the pros and cons of each, and which to learn first.

Title card for Tailwind CSS vs CSS, comparing a .save-button rule with padding 0.5rem 1rem to the Tailwind classes px-4 py-2, next to the blue Save button both produce

Two developers build the same blue button. One opens a stylesheet, invents a class name, and writes a CSS rule. The other never leaves the HTML and types a row of short class names. The buttons look the same, but the code behind them reads very differently.

Tailwind CSS gives you small, ready-made classes like p-4 and bg-blue-600 to combine in your HTML, while plain CSS means writing your own rules in a stylesheet. Tailwind is built on CSS and turns each class into CSS for you. So Tailwind CSS vs CSS isn't a choice between two languages. It's a choice between two ways of writing the same CSS, and you need to know CSS for both.

What is Tailwind CSS?

Tailwind calls itself a utility-first CSS framework. A framework is a ready-made toolkit you build on. A utility class is a class that does one small job: flex sets display: flex, and text-center centers text. You build a design by putting many of them on one element.

Tailwind isn't one big stylesheet you download. Instead, a build tool (a program that prepares your code before it goes live) scans your files for class names. Then it writes one CSS file with only the classes you used. You can try Tailwind in the browser with its Play CDN script, but that's for experiments, not for live sites.

The same button written both ways

Here's a blue button with rounded corners that darkens when the mouse is over it, in plain CSS:

<button class="save-button">Save</button>
.save-button {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background-color: #2563eb;
  color: white;
  font-weight: 600;
}

.save-button:hover {
  background-color: #1d4ed8;
}

You invent a name, save-button, and write a rule for it. The :hover rule changes the color while the mouse is over the button. Now the same button in Tailwind:

<button class="rounded-lg bg-blue-600 px-4 py-2 font-semibold text-white hover:bg-blue-700">
  Save
</button>

There's no stylesheet to open. Each class stands for one piece of CSS:

Tailwind class The CSS it adds
px-4 padding-inline: 1rem, the left and right padding
py-2 padding-block: 0.5rem, the top and bottom padding
rounded-lg border-radius: 0.5rem
bg-blue-600 a blue background-color from Tailwind's color palette
text-white a white text color
font-semibold font-weight: 600
hover:bg-blue-700 a darker blue background, only on hover

Spacing classes come from a scale where each step is 0.25rem, so px-4 is 1rem. The hover: part is called a variant. It applies the class only when its condition is true.

The same blue Save button written in plain CSS, with a .save-button rule and a :hover rule, and in Tailwind, with seven utility classes. Arrows map px-4 to padding-inline 1rem, py-2 to padding-block 0.5rem, rounded-lg to border-radius 0.5rem, and font-semibold to font-weight 600
One button, two ways of writing the same CSS.

Isn't Tailwind just inline styles?

Partly. Like an inline style, the styling sits right on the element. But utility classes do three things a style attribute can't:

  • Stick to a design scale. You pick p-4 from a set of steps instead of typing any number, so spacing and colors stay consistent.
  • Style states. An inline style can't target hover or focus, but hover: and focus: variants can.
  • Change with screen size. md:flex applies only on medium screens and wider. Inline styles can't use media queries.

They're also plain classes, so they keep specificity low. An inline style beats every selector, while a utility class scores like any other class. CSS specificity explains why that matters.

What are the pros of Tailwind?

  • No names to invent. You skip deciding between card-title and card-heading.
  • Safer changes. A class on one element only affects that element, so you won't break another page by accident.
  • CSS that stops growing. The same small classes get reused everywhere, so the stylesheet doesn't grow with every feature.
  • Built-in consistency. Spacing, colors, and font sizes come from one shared theme.
  • States and screen sizes in one place. Prefixes like hover:, dark:, and md: sit in the same class list. Tailwind is mobile first: a class with no prefix applies at every size, and md: applies from that breakpoint up.

What are the cons of Tailwind?

  • Long class lists. Seven or eight classes on one button is normal, and the HTML gets harder to scan.
  • A new vocabulary. You learn names like px-4 and rounded-lg on top of the CSS they stand for.
  • A build step. Tailwind needs a tool to generate its CSS. Plain CSS works in any browser as it is.
  • Repeated class lists. Ten buttons can mean the same eight classes, ten times. The fix is a component, a piece of UI you write once and reuse, like a React Button.
  • Modern browsers only. Tailwind is designed for modern browsers. If you must support old ones, check its compatibility page first.
  • Surprising conflicts. With class="grid flex", the class that comes later in Tailwind's stylesheet wins, not the one you wrote last. So never put two classes for the same property on one element.

What are the pros and cons of plain CSS?

Plain CSS works in every browser with no setup. It keeps your HTML short, lets you name and organize styles your way, and teaches skills that work with any framework.

The costs show up as a project grows. You name everything, rules start to clash, and specificity fights begin. Old rules pile up because it's hard to tell which ones are still used, and shipping less CSS shows how to find them. Keeping spacing and colors consistent takes discipline, usually with CSS variables (named values you reuse) like --brand-blue.

How do Tailwind and plain CSS compare?

Plain CSS Tailwind CSS
Where styles live A separate stylesheet Classes in the HTML
Naming You name every class Few or no custom names
Setup None, browsers read it directly A build step
Design values Any value you type A shared scale, plus one-off values like bg-[#316ff6]
Hover and screen sizes :hover and @media rules hover: and md: prefixes
Reusing a design Reuse a class Reuse a component
Good fit Learning, small sites, unusual designs Component-based apps, teams sharing one design scale

Do you need to know CSS to use Tailwind?

Yes. Each Tailwind class is a short name for CSS you could write yourself. A class list like flex items-center justify-between only makes sense if you know flexbox. When a layout breaks, DevTools shows you the plain CSS behind each class, and you fix it with CSS thinking.

Think of Tailwind as a set of keyboard shortcuts. They make an expert faster, but they don't teach anyone what the commands do. Learn the box model, specificity, flexbox, grid, and units first. Then Tailwind becomes a faster way to write what you already know.

When should you use each?

  • Pick plain CSS while you're learning, for small sites and one-off pages, or when you can't add a build step.
  • Pick Tailwind for apps built from components in React, Vue, or Next.js, where each component keeps its markup and styles together. It also suits teams that want one shared design scale.
  • Mix them when it helps. Tailwind projects can still include custom CSS, and inline styles are fine for values that come from a database.

Where should you go next?

If you're new to styling, start with HTML vs CSS vs JavaScript, then the CSS box model and flexbox vs grid. Responsive web design shows the media queries that Tailwind's md: prefixes write for you.

When you're ready to use Tailwind in a real app, Tailwind CSS in Next.js covers setup, themes, and dark mode. CSS in Next.js covers the plain CSS options, like CSS Modules. And the React course teaches the components that keep Tailwind class lists short.