Back to blog

Using Tailwind CSS with Next.js

May 15, 2023

Tailwind CSS is a utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.

Why Tailwind CSS?

Tailwind CSS allows you to build modern websites without ever leaving your HTML. It provides low-level utility classes that let you build completely custom designs.

Setting up Tailwind CSS in Next.js

To add Tailwind CSS to your Next.js project, install the required packages:

npm install -D tailwindcss postcss autoprefixer

Then, create the configuration files:

npx tailwindcss init -p

This will create a tailwind.config.js and postcss.config.js file in your project root.