0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Tailwind CSS v4 でCSSが当たらない時の対処法(Vite + React + TypeScript

Posted at

Tailwind CSS v4 で CSS が効かないときの対処法【Vite + React】

Tailwind CSS v4 にしてから @tailwind base; と書いても CSS が反映されず困ったので、原因と解決法をまとめます。


💥 症状

  • class="flex" などを書いても見た目が変わらない
  • エラーは出ない
  • <style> タグはあるけど中身が空

✅ 原因

Tailwind CSS v4 からは、@tailwind base; などのディレクティブが使えなくなりました。
代わりに @import "tailwindcss"; を使う必要があります。


🔧 解決方法

src/index.css を以下のように修正:

- @tailwind base;
- @tailwind components;
- @tailwind utilities;

+ @import "tailwindcss";
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?