是否可以通过CSS将水平渐变设置为文本? (左字母一种颜色,右边一种颜色)。
答案 0 :(得分:6)
是的,是的。
h1 {
font-size: 72px;
background: -webkit-linear-gradient(left, red , yellow);
background: -o-linear-gradient(right, red, yellow);
background: -moz-linear-gradient(right, red, yellow);
background: linear-gradient(to right, red , yellow);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<h1>Hello World</h1>