如何实现这一点:https://imgur.com/mDmXtAV
我的示例代码:
h1 {
position: relative;
color: #FFF;
}
h1:after {
content: attr(data-content);
position: absolute;
color: #000;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: red;
}<h1 data-content="Hello world!">Hello world!</span>
发布于 2021-03-26 10:18:58
您可以使用CSS linear-gradient函数来达到想要的效果。
body {
background-color: #1D1D31;
padding: 50px 50px;
}
h1 {
display: inline-block;
position: relative;
padding: 10px 30px;
color: #fff;
background: linear-gradient(90deg,#314563 0,#5d6d85 70%,#8292a1 100%)
}<h1>Hello world!</span>
https://stackoverflow.com/questions/66810052
复制相似问题