MyInternships.in

Getting Started

Installation and Setup

There are two common ways to add Tailwind: the Play CDN for quick experiments and learning, and a proper build (npm) for production projects.


Fastest way: the Play CDN

For learning or a quick demo, drop one <script> tag in your page. No build step required — this is exactly what the editor in this course uses.

A complete page using the Play CDN
Example
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
  <h1 class="text-3xl font-bold text-sky-600 p-6">Hello Tailwind!</h1>
</body>
</html>
⚠️

The Play CDN is great for learning and prototypes, but do not use it in production — it is larger and slower than a built stylesheet.

Production: install with npm

For a real project you install Tailwind, generate a config file, and let the build tool scan your files and output only the classes you actually use.

Terminal
npm install -D tailwindcss
npx tailwindcss init

Point the config at your template files, add the Tailwind directives to your CSS, and run the build.

src/input.css
@tailwind base;
@tailwind components;
@tailwind utilities;
Build (watch mode)
npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch
ℹ️

Frameworks like Next.js, Vite and Astro have official Tailwind guides that wire this up for you in a couple of steps.

Related Tailwind Topics

Keep learning with these closely related lessons.