首页 > 文章列表 > 如何使用css实现​文本渐变

如何使用css实现​文本渐变

css
239 2023-05-16

文本渐变

文本渐变效果很流行,使用 CSS3 能够很简单就实现:

h3[data-text] {
 position: relative;
}
h3[data-text]::after {
 content: attr(data-text);
 z-index: 10;
 color: #e3e3e3;
 position: absolute;
 top: 0;
 left: 0;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,0)), color-stop(50%, rgba(0,0,0,1)), to(rgba(0,0,0,0)));}