gpt4 book ai didi

css - 渐变文字颜色

转载 作者:行者123 更新时间:2023-11-27 23:46:18 25 4
gpt4 key购买 nike

是否有生成器或生成this之类的文本的简便方法,而无需定义每个字母

所以像这样:



.rainbow {
background-image: -webkit-gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2),color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22) );
background-image: gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2),color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22) );
color:transparent;
-webkit-background-clip: text;
background-clip: text;
}

<span class="rainbow">Rainbow text</span>





但是不是用彩虹色而是用其他颜色(例如,白色到灰色/浅蓝色渐变等)生成的,我找不到适合的解决方案。有什么办法吗?

最佳答案

我不完全了解Stop的工作原理。
但是我有一个渐变文本示例。也许这会帮到您!

_您也可以根据需要为渐变添加更多颜色,或者从color generator中选择其他颜色


.rainbow2 {
background-image: -webkit-linear-gradient(left, #E0F8F7, #585858, #fff); /* For Chrome and Safari */
background-image: -moz-linear-gradient(left, #E0F8F7, #585858, #fff); /* For old Fx (3.6 to 15) */
background-image: -ms-linear-gradient(left, #E0F8F7, #585858, #fff); /* For pre-releases of IE 10*/
background-image: -o-linear-gradient(left, #E0F8F7, #585858, #fff); /* For old Opera (11.1 to 12.0) */
background-image: linear-gradient(to right, #E0F8F7, #585858, #fff); /* Standard syntax; must be last */
color:transparent;
-webkit-background-clip: text;
background-clip: text;
}
.rainbow {

background-image: -webkit-gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2),color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22) );
background-image: gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2),color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22) );
color:transparent;
-webkit-background-clip: text;
background-clip: text;
}

<span class="rainbow">Rainbow text</span>
<br />
<span class="rainbow2">No rainbow text</span>

关于css - 渐变文字颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56786641/

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