gpt4 book ai didi

css - 顺风 CSS : how to apply background image with linear gradient?

转载 作者:行者123 更新时间:2023-12-03 21:41:24 25 4
gpt4 key购买 nike

我想对我的背景图像应用线性渐变。在顺风配置文件中,我写了一个这样的自定义规则:

 theme: {
extend: {
backgroundImage: (theme) => ({
'hero-pattern': "url('../src/images/icon-bg.jpg')",

}),
},
},
有用。但是当我尝试应用线性渐变时,它不起作用。
为了应用线性梯度,我尝试过的是:
 theme: {
extend: {
backgroundImage: (theme) => ({

'hero-pattern':
"linear-gradient(to right bottom, rgba('#7ed56f',0.8), rgba('#28b485',0.8)), url('../src/images/icon-bg.jpg')",
}),
},
},
但它没有用。

最佳答案

不要使用函数。只是尝试作为一个实用程序

theme: {
extend: {
backgroundImage: {
'hero-pattern': "linear-gradient(to right bottom, rgba('#7ed56f',0.8), rgba('#28b485',0.8)), url('../src/images/icon-bg.jpg')",
},
},
},
这是一个工作示例 https://play.tailwindcss.com/uHp6pKIKEc

关于css - 顺风 CSS : how to apply background image with linear gradient?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67344478/

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