文字外发光效果如果使用text-shadow,会使渐变色受到影响。在伪类上使用filter,模拟发光效果。
.text {
background: linear-gradient(180deg, #fefff5 40%, #91ec72 80%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.text::before {
content: "";
position: absolute;
left: 50%;
top: 0;
width: 60%;
height: 100%;
transform: translateX(-50%);
background-color: rgba(136, 252, 0, 0.25);
filter: blur(10px);
z-index: -1;
}
效果如图: