Bolt ui

Tailwind CSS Classes Not Applying - Styles Ignored

Tailwind CSS classes aren't being applied to elements. You add classes like 'bg-blue-500' but the element stays unstyled.

Sometimes works in some components but not others. Manual styles work fine.

Error Messages You Might See

Tailwind CSS not found Styles not applying Class text-blue-500 not recognized PostCSS plugin error
Tailwind CSS not foundStyles not applyingClass text-blue-500 not recognizedPostCSS plugin error

Common Causes

  1. Tailwind not configured in tailwind.config.js or config missing CSS input path
  2. CSS file not imported in main layout or root component
  3. Dynamic class names (string templates) not scanned by Tailwind content config
  4. CSS Autoprefixer or PostCSS not configured properly
  5. Purged classes - content config doesn't include template files with classes

How to Fix It

Verify tailwind.config.js content includes all template paths: content: ['./src/**/*.{js,jsx,ts,tsx}']

Ensure CSS imported in root: import 'tailwindcss/tailwind.css'

Avoid dynamic class names: const className = `text-${color}` won't work. Use full class names or Tailwind merge utility

Check PostCSS config has Tailwind plugin

Rebuild after config changes: npm run dev

Real developers can help you.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Why don't dynamic Tailwind classes work?

Tailwind uses static analysis. text-${color} is a template and Tailwind can't scan it. Use full class names or mapping

How do I use arbitrary values instead?

Use bracket syntax: bg-[#1234567] for custom colors, or configure in tailwind.config.js

Should I use CSS modules with Tailwind?

Tailwind works best without CSS modules. Use utility-first directly in JSX

Related Bolt Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help