Tailwind CSS
Write CSS without naming anything. Liberation.
▶ the lesson · narrated sketch video · tap for sound
the intro
Tailwind is utility-first CSS: instead of writing class names and stylesheets, you compose tiny single-purpose classes directly in your markup. Padding, colors, layouts — all from a consistent scale. It feels weird for a week, then remarkably fast.
the sample
a styled card, no stylesheet
<div class="rounded-xl bg-white p-4
shadow-md border-2">
<h2 class="text-xl font-bold">Hi</h2>
<p class="text-gray-500">Utility CSS.</p>
</div>fun fact ✦
Tailwind CSS v1 shipped in 2017 and split the frontend internet in half. The halves still argue.
the docs
the deep dive
the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid
Every class name you invent is a small decision, and decisions cost time you do not have. Tailwind removes the naming and hands you a fixed vocabulary: p-4 is always 16 pixels, everywhere, forever. You traded names for consistency, and after about a week most people never want the names back.
you traded names for consistency
key terms
utility class
One class = one CSS decision. Compose them like words; the build compiles only the ones you actually use.
class="p-4 text-sm"the scale
Spacing and size steps in 4px multiples, so every gap on the site agrees with every other gap.
p-1 = 4px, p-4 = 16pxvariant
A state prefix in front of a utility: hover, focus, dark, md. Same utility, new condition.
hover:bg-blue-600arbitrary value
Square brackets accept any value for one-offs — no config edit, no new class name.
w-[37px] bg-[#1da1f2]how it works
- 1Install once
Add the package and one CSS import. The build scans your files and generates only the classes you actually used.
- 2Compose in the markup
class="rounded-lg px-4 py-2 bg-indigo-600" reads like a spec sheet. Weird for a week, then fast forever.
- 3Stay on the scale
Reach for the nearest step instead of 13px. The constraint is the feature: rhythm without meetings.
- 4Extract when repeated
The same utility string five times? Make it a component. Reuse belongs at the component layer, not the class layer.
the code, explained
a button, fully styled, no stylesheet
side by side
tailwind
- zero naming decisions
- styles live beside markup
- one shared scale enforced
- unused classes never ship
css files
- full CSS power, no build
- names you control
- reuse via real classes
- context-switching between files
Resist @apply. Rebuilding semantic classes out of utilities is just CSS with extra steps, and it hides the styles away from the markup they style. When a pattern repeats, extract a component instead — that is the escape hatch the framework-agnostic way.
quick answers
Does ten classes per element get ugly?
Yes, and that is the trade: verbose markup in exchange for zero naming, no context switching, and a compiled stylesheet measured in kilobytes.
Will it make me worse at CSS?
No — every utility is a real CSS declaration in costume. You still learn flexbox, specificity, and the box model; just inline.
What if Tailwind lacks a value I need?
Arbitrary values like w-[37px] cover one-offs. If it repeats, extend the theme config or write plain CSS next to it.
quick hits about Tailwind CSS
short answers · interviews, tips, trivia & hidden gems
Is utility CSS real CSS?watch ↗
Does Tailwind make you worse at CSS?watch ↗
Why p-4 and not padding 16px?watch ↗
Dark mode in one prefix?watch ↗
Style a child when the parent hovers?watch ↗
Need a real class name?watch ↗
Weird one-off value?watch ↗