How to install Tailwind CSS v3 in your Next.js application
Style your Next.js Application using Tailwind CSS v3 for broader browser support.
This guide will walk you through how to install Tailwind CSS v3 in your Next.js application.
Good to know: For the latest Tailwind 4 setup, see the Tailwind CSS setup instructions.
Installing Tailwind v3
Install Tailwind CSS and its peer dependencies, then run the init
command to generate both tailwind.config.js
and postcss.config.js
files:
Configuring Tailwind v3
Configure your template paths in your tailwind.config.js
file:
Add the Tailwind directives to your global CSS file:
Import the CSS file in your pages/_app.js
file:
Using classes
After installing Tailwind CSS and adding the global styles, you can use Tailwind's utility classes in your application.
Usage with Turbopack
As of Next.js 13.1, Tailwind CSS and PostCSS are supported with Turbopack.