我正在尝试应用渐变到我的导航链接,但它没有显示任何结果。这是我的代码
<NavLink className="block p-4 pr-0 mr-3 bg-gradient-to-br from-purple-500
to-indigo-500 rounded-tr-full rounded-br-full text-textPrimary
hover:text-white text-xl" to="/dashboard">
<i class="fas fa-laptop-house mr-3"></i>
Dashboard
</NavLink>我正在使用顺风css和react
发布于 2020-11-23 05:22:27
这应该可以正常工作(https://play.tailwindcss.com/xnQDaASzOL)。
您的<NavLink />组件可能有问题。className属性能很好地传播到内部组件吗?
事实上,React不理解自定义组件的className,直到您将其传播到内部组件,请参见此answer。
发布于 2021-04-27 07:56:19
看起来您的配置中没有配色方案。
只需将此代码添加到您的tailwind.config.js中。
const colors = require("tailwindcss/colors");
module.exports = {
theme: {
colors: {
blue: {
...colors.blue,
"your custom blue color"
},
green: colors.green,
pink: colors.pink
...etc
}
},
};应该能行得通。只需选择要包含在模式中的颜色即可。...colors.blue将为您提供所有深浅不一的蓝色。在此之后,渐变与蓝色应该可以工作。
https://stackoverflow.com/questions/64913959
复制相似问题