我是 Tailwind CSS 新手。我在构建 React 项目时遇到此错误:
该类
hover:不存在。如果hover:是自定义类,请确保它是在@layer指令中定义的。
我在 StackOverflow 上发现了类似的问题,但它对我没有帮助。谁能告诉我为什么会发生这种情况?
//Index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.btn-purple {
@apply px-4 py-1 text-sm text-purple-600 font-semibold border border-purple-200 rounded-full hover: text-white hover:bg-purple-600 hover:border-transparent focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-offset-2;
}
}
Run Code Online (Sandbox Code Playgroud) tailwind-css ×1