文字使用css渐变字体颜色

半腔热情 提交于 2019-11-26 09:03:17

方法:

 background-image: linear-gradient(
              0deg,
              rgba(255, 171, 0, 1) 7.5439453125%,
              rgba(255, 250, 142, 1) 100%
            );
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;

说明:
background-image:为文本元素提供渐变背景
-webkit-text-fill-color: transparent 使用透明颜色填充文本。
-webkit-background-clip: text 用文本剪辑背景,用渐变背景作为颜色填充文本。

效果:
在这里插入图片描述

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!