1. Installation
  2. Install Tailwind CSS with Astro

Installation

Install Tailwind CSS with Astro

Setting up Tailwind CSS in an Astro project.

01

Create your project

Start by creating a new Astro project if you don't have one set up already. The most common approach is to use create astro.

Terminal
npm create astro@latest my-project
cd my-project
02

Run `astro add` command

Run this command to install all the necessary dependencies, create a ./src/styles/global.css file, and add the plugin to your Astro configuration file.

Terminal
npx astro add tailwind
03

Start your build process

Run your build process with npm run dev.

Terminal
npm run dev
04

Start using Tailwind in your project

Start using Tailwind's utility classes to style your content while making sure to import the newly created CSS file.

index.astro
---
import "../styles/global.css";
---
<h1 class="text-3xl font-bold underline">
Hello world!
</h1>
Copyright © 2025 Tailwind Labs Inc.·Trademark Policy