【发布时间】:2017-02-14 12:08:54
【问题描述】:
是否可以通过 CSS 将水平渐变设置为文本? (左字母一种颜色,右字母另一种颜色)。
【问题讨论】:
是否可以通过 CSS 将水平渐变设置为文本? (左字母一种颜色,右字母另一种颜色)。
【问题讨论】:
是的。
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>
【讨论】:
mix-blend-mode 支持:caniuse.com/#search=mix-blend-mode