Practical uses
- Prototype polished interfaces quickly
- Enforce consistent design tokens
- Build responsive component libraries
- Style application UIs close to their markup
A CSS framework built from small utility classes you apply directly in your HTML.
Tailwind CSS gives you small, single-purpose classes such as `p-4` and `text-center` that you combine in your HTML to style pages. It cuts down on writing custom CSS and naming classes, and it keeps spacing and colors consistent.
Install Tailwind with npm and set it up with PostCSS. It works with most tools and frameworks, including Vite, Next.js, Astro and plain HTML. You do not need this to follow the lessons: the examples run in your browser.
# Via Vite (recommended for new projects):
npm create vite@latest my-project -- --template vanilla
cd my-project
npm install -D tailwindcss @tailwindcss/vite
# Edit vite.config.js to add the Tailwind plugin,
# then add @import "tailwindcss" to your CSS file.
# Or standalone for plain HTML:
npm install -D tailwindcss
npx tailwindcss initLearn the basics first, then pick up these tools when a project needs them.