是否可以通过CSS将水平渐变设置为文本?(左字母一种颜色,右边 - 另一种颜色)

Rom*_*dii 3 css text gradient css3

是否可以通过CSS将水平渐变设置为文本?(左字母一种颜色,右边一种颜色).

kin*_*ser 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;
}
Run Code Online (Sandbox Code Playgroud)
<h1>Hello World</h1>
Run Code Online (Sandbox Code Playgroud)