Tailwind CSS
A CSS framework for styling web pages by combining small, single-purpose classes in your markup. Each class handles a task such as adding padding, setting a background color, or arranging items in a row.
Also known as: Tailwind
What is Tailwind CSS?
Tailwind CSS is a utility-first framework for styling web interfaces. Suppose a panel needs padding, a light background, and rounded corners. Rather than naming a .panel class and writing those rules in a separate stylesheet, you can put p-4 bg-slate-100 rounded-lg on the element. Tailwind supplies the styling vocabulary, not the panel itself: you still choose the HTML element, its content, and how it behaves.
From class names to CSS
Tailwind scans source files for recognizable class names and generates the corresponding CSS. The browser applies those rules through the normal CSS cascade. Utility classes are not inline styles: they can express conditions such as focus-visible: for a visible focus state or md: for widths at or above a configured breakpoint.
Many utilities use a shared theme. For example, p-4 and gap-4 control different properties but draw from the same spacing scale. A team can customize that scale, along with colors and breakpoints, to match its design system. One-off values are also possible: w-[18rem] sets a width of 18rem without adding a new value to the shared scale.
Example: one column first
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<article class="rounded-lg bg-slate-100 p-4">Shipping</article>
<article class="rounded-lg bg-slate-100 p-4">Payment</article>
</div>
The parent is a grid at every viewport width. It starts with one column and switches to two at the md breakpoint. The gap between cards stays the same because gap-4 is not tied to a breakpoint. This is Tailwind's mobile-first pattern: set a base layout with unprefixed classes, then override what needs to change at larger widths.
Where it fits and what to watch for
Tailwind works in plain HTML templates as well as in React, Vue, and Svelte projects. Keeping styles beside the markup makes it easy to see what changes one element, but long class lists can make templates harder to scan. If the same markup and styling recur together, a reusable component such as ProductCard can keep both in one place. Regular CSS remains useful for cases such as complex animations.
A common mistake is to build a class name from fragments, as in bg-${color}-500. The scanner does not run your JavaScript to discover the resulting string. Instead, map each permitted color to a complete class name such as bg-red-500 or bg-blue-500 so Tailwind can detect it in the source.
In a frontend interview
Be ready to explain why md:grid-cols-2 still applies above the md breakpoint, or why swapping p-2 and p-4 inside a class attribute does not reliably change the padding. The browser resolves the conflict using the CSS cascade, not the order of class names in the markup.