What is Tailwind CSS?
Dan Counsell · Founder of Realmac SoftwareUpdated
We’ve made RapidWeaver, a website builder for Mac, since 2004. Each guide works with any tool, then shows how in RapidWeaver Elements.
Tailwind CSS is one of the most popular ways to style websites. If you’ve looked at a modern site’s code and seen long lists of short class names, that’s probably Tailwind.
How Tailwind CSS works
In plain CSS, you write a class name in your HTML and the styles for it in a separate file:
<button class="buy-button">Buy now</button>
.buy-button { background: #196ee4; color: white; padding: 8px 16px; border-radius: 9999px; }
With Tailwind, you add small ready-made classes straight to the HTML:
<button class="bg-blue-600 text-white px-4 py-2 rounded-full">Buy now</button>
Each class does one thing. px-4 adds padding left and right, rounded-full makes a pill shape. There’s no separate stylesheet to write.
Responsive and hover styles
Tailwind uses prefixes for screen sizes and states. md:text-xl makes text larger from the medium breakpoint up. hover:bg-blue-700 changes the colour on hover. This makes responsive design quick, because the rules sit right on the element.
Why people like Tailwind
- Speed. No naming things or switching files.
- Consistency. Spacing, colours and sizes come from one set of values, so designs stay tidy.
- Small files. Tailwind only includes the classes you use when it builds your CSS.
- Easy to change. Delete an element and its styles go with it.
The downsides
- Busy HTML. Long class lists can be hard to read.
- Learning the names. You need to learn what
mt-6orgap-x-4means. A Tailwind cheat sheet helps. - A build step. For the best results, Tailwind runs a tool that builds your CSS file.
Tailwind CSS vs Bootstrap
Bootstrap gives you finished components, such as a navbar or a card, with a look you then adjust. Tailwind gives you building blocks and no default look. Bootstrap is quicker for a standard layout. Tailwind makes it easier for each site to look like itself.
Use Tailwind CSS without writing code
RapidWeaver Elements is built on Tailwind CSS. You design visually with controls for spacing, colour, type and layout, and Elements writes the Tailwind classes for you. When you want to go further, you can type classes straight onto any component. See our Tailwind visual builder page for more.
Questions about Tailwind CSS
Is Tailwind CSS free?
Yes. Tailwind CSS is free and open source. There are paid component kits made with it, but the framework itself costs nothing.
Is Tailwind good for beginners?
It’s a good way to learn CSS, because each class maps to one CSS property. If you don’t want to learn the class names, a visual builder that writes Tailwind for you is a gentler start.
Does Tailwind work with any website?
Yes. It’s plain CSS in the end, so it works on any site and any host.