【发布时间】:2021-08-25 18:17:54
【问题描述】:
我是前端开发的新手,我尝试构建新的 react-tailwindcss 项目。我的项目抛出错误,例如“hover: 类不存在。如果hover: 是自定义类,请确保它在@layer 指令中定义。”,知道吗?
global.css:
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.icon{
@apply hidden xl:inline-flex p-2 h-10 w-10 bg-gray-200 rounded-full text-gray-700
cursor-pointer hover: bg-gray-300;
}
.inputIcon{
@apply flex items-center space-x-1 hover: bg-gray-100
flex-grow justify-center p-2 rounded-xl cursor-pointer ;
}
}
【问题讨论】:
-
你安装了tailwind-css的包吗
-
@Skysoft13,是的,我愿意 :)
-
"hover:" 和样式之间不能有空格。例如,
hover: bg-gray-100应该是hover:bg-gray-100 -
@CraigE,tnx 这么多:)
标签: reactjs tailwind-css