Introduction
Tailwind helps you style websites quickly using ready-made classes. Installing it sets up your project to use these styles easily.
Jump into concepts and practice - no test required
Tailwind helps you style websites quickly using ready-made classes. Installing it sets up your project to use these styles easily.
npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p
npm install -D tailwindcss postcss autoprefixer
tailwind.config.js and postcss.config.js files to set up Tailwind.npx tailwindcss init -p
@tailwind base; @tailwind components; @tailwind utilities;
This simple page uses Tailwind classes to center text and style it with color and size. The CSS file dist/output.css is the processed Tailwind CSS.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Tailwind Setup Example</title> <link href="dist/output.css" rel="stylesheet" /> </head> <body class="bg-gray-100 flex items-center justify-center min-h-screen"> <h1 class="text-4xl font-bold text-blue-600">Hello, Tailwind!</h1> </body> </html>
Make sure you have Node.js installed to run npm commands.
After setup, use a build tool or Tailwind CLI to create your CSS file.
Check your terminal for errors if styles don't show up.
Tailwind installation uses npm to add needed packages.
Configuration files tell Tailwind how to work in your project.
Include Tailwind directives in your CSS to use its styles.
npm to install packages.npm is the standard package manager for JavaScript projects, including Tailwind.npm install <package-name>.npm install tailwindcss correctly installs Tailwind CSS.tailwind.config.js to customize its behavior.package.json manages packages, index.html is the webpage, and style.css holds styles but not Tailwind config.npm install tailwindcss to add Tailwind to your project.tailwind.config.js to customize Tailwind settings.@tailwind base;, @tailwind components;, and @tailwind utilities; in your CSS file.