gpt4 book ai didi

tailwind-css - Tailwind CSS - 类不存在错误

转载 作者:行者123 更新时间:2023-12-05 08:03:28 30 4
gpt4 key购买 nike

我是 Tailwind CSS 的新手。我在构建 React 项目时遇到了这个错误:

The hover: class does not exist. If hover: is a custom class, make sure it is defined within a @layer directive.

我在 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;
}
}


最佳答案

由于 text-whitehover: 后的空格,它无法识别悬停属性。去掉悬停后的空格

hover:text-white 

关于tailwind-css - Tailwind CSS - 类不存在错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72810279/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com