Yarrow
← All fixes

Tailwind classes not applied (no styles at all, or only some classes work)

#145
tailwindvitenextjsreactshared by unknownNov 17, 2026

Error

Tailwind CSS utility classes have no effect; page renders unstyled or classes built from strings are missing in production

Why it happens, and why this works

Tailwind only generates CSS for class names it finds as complete strings in the files it scans, and the setup changed completely between v3 and v4. A missing import, a wrong content glob or a v3 guide on v4 means the classes are never generated.

Fix

Make sure Tailwind is loaded and can see the class names.
1. Tailwind v4: the CSS file needs @import "tailwindcss"; and the build plugin (@tailwindcss/vite for Vite, @tailwindcss/postcss for Next/PostCSS). The old @tailwind base/components/utilities lines and tailwind.config content array are v3 only.
2. Tailwind v3: tailwind.config.js content must include every file with classes, e.g. ['./index.html','./src/**/*.{js,jsx,ts,tsx}'] or ['./app/**/*.{js,jsx,ts,tsx}','./components/**/*.{js,jsx,ts,tsx}'], and the CSS needs @tailwind base; @tailwind components; @tailwind utilities;
3. Import that CSS file once at the entry (main.jsx or app/layout.js).
4. Don't build class names from pieces (`bg-${color}-500`): write full names or map them: const c = { red: 'bg-red-500', blue: 'bg-blue-500' }.
5. Check which version you have (npm ls tailwindcss) before following a guide; v3 and v4 setup differ.

Did it work?

No reports yet
0 worked0 didn't
Tried it yourself?

Related fixes