Learn the different ways to add Tailwind CSS to your project.
There are two primary ways to start using Tailwind CSS in your project:
Quick start, no install needed
Best for beginnersUses npm, compiles CSS locally
Real projectsFramework integrations (React, Vue…)
Advanced setup
Add a single
<script> tag inside
your HTML <head>:
<!-- Paste inside <head> -->
<script src="https://cdn.tailwindcss.com"></script>
Your full HTML boilerplate looks like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<!-- Your content here -->
</body>
</html>
The CLI compiles a minimal CSS file containing only the classes you actually use in your project.
npm install -D tailwindcss
npx tailwindcss init
tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./**/*.html"],
theme: { extend: {} },
plugins: [],
}
/* css/input.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
npx tailwindcss -i ./css/input.css -o ./css/output.css --watch
| Feature | Play CDN | Tailwind CLI |
|---|---|---|
| Setup time | Instant (1 line) | ~5 minutes |
| Requires Node.js? | No | Yes |
| CSS bundle size | Very large (full CSS) | Tiny (purged CSS) |
| Works offline? | No | Yes |
| Use in production? | No | Yes |
| Best for | Learning & prototyping | Real production projects |