Installation
Get started with Tailwind CSS
Tailwind CSS works by scanning all of your HTML files, JavaScript components, and any other templates for class names, generating the corresponding styles and then writing them to a static CSS file.
It's fast, flexible, and reliable — with zero-runtime.
Installing Tailwind CSS as a PostCSS plugin
Installing Tailwind CSS as a PostCSS plugin is the most seamless way to integrate it with build tools like webpack, Rollup, Vite, and Parcel.

Install Tailwind CSS
Install
tailwindcssand its peer dependencies via npm, and create yourtailwind.config.jsfile.Terminalnpm install -D tailwindcss postcss autoprefixernpx tailwindcss initAdd Tailwind to your PostCSS configuration
Add
tailwindcssandautoprefixerto yourpostcss.config.jsfile, or wherever PostCSS is configured in your project.postcss.config.jsmodule.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, } }Configure your template paths
Add the paths to all of your template files in your
tailwind.config.jsfile.tailwind.config.js/** @type {import('tailwindcss').Config} */ module.exports = { content: ["./src/**/*.{html,js}"], theme: { extend: {}, }, plugins: [], }Add the Tailwind directives to your CSS
Add the
@tailwinddirectives for each of Tailwind’s layers to your main CSS file.main.css@tailwind base; @tailwind components; @tailwind utilities;Start your build process
Run your build process with
npm run devor whatever command is configured in yourpackage.jsonfile.Terminalnpm run devStart using Tailwind in your HTML
Make sure your compiled CSS is included in the
<head>(your framework might handle this for you), then start using Tailwind’s utility classes to style your content.index.html<!doctype html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="/dist/main.css" rel="stylesheet"> </head> <body> <h1 class="text-3xl font-bold underline"> Hello world! </h1> </body> </html>
Are you stuck? Setting up Tailwind with PostCSS can be a bit different across different build tools. Check our framework guides to see if we have more specific instructions for your particular setup.Explore our framework guides
What to read next
Get familiar with some of the core concepts that make Tailwind CSS different from writing traditional CSS.
Utility-First Fundamentals
Using a utility-first workflow to build complex components from a constrained set of primitive utilities.
Responsive Design
Build fully responsive user interfaces that adapt to any screen size using responsive modifiers.
Hover, Focus & Other States
Style elements in interactive states like hover, focus, and more using conditional modifiers.
Dark Mode
Optimize your site for dark mode directly in your HTML using the dark mode modifier.
Reusing Styles
Manage duplication and keep your projects maintainable by creating reusable abstractions.
Customizing the Framework
Customize the framework to match your brand and extend it with your own custom styles.

