Direct effect
can not see the effect point here
Method 1: With the help of mask-image attribute
<!-- more -->
It can be seen from the CSS code that in addition to the "content content generation technology", the effect is mainly achieved by using the mask-image attribute, and the content is "gradient under the core webkit browser".
<h2 class="text-gradient" data-text="【css灵感】渐变字">【css灵感】渐变字</h2>
<style>
.text-gradient {
display: inline-block;
font-family: '微软雅黑';
font-size: 10em;
position: relative;
}
.text-gradient[data-text]::after {
content: attr(data-text);
color: green;
position: absolute;
left: 0;
z-index: 2;
-webkit-mask-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#ff0000), to(rgba(0, 0, 255, 0)));
}
</style>
Method 2: Implementation under background-clip + text-fill-color
Although this method uses relatively more CSS properties, it has a simple structure and is easy to control. The selection and control of colors are also more precise, and it is easier to understand. I personally recommend the second method.
<h1 class="text-gradient">【css灵感】渐变字</h1>
<style>
.text-gradient {
display: block;
color: green;
font-size: 4em;
text-align:center;
font-family: '微软雅黑';
background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#ebeef2), to(#2e9fff));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
};
</style>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。