Installation
Setting up Tailwind CSS in an Astro 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.
npm create astro@latest my-projectcd my-project
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.
npx astro add tailwind
Run your build process with npm run dev
.
npm run dev
Start using Tailwind's utility classes to style your content while making sure to import the newly created CSS file.
---import "../styles/global.css";---<h1 class="text-3xl font-bold underline"> Hello world!</h1>