其實我覺得這裏用了一點偷換概念的思想,與其是說讓字體顏色font-size漸變,不如說是控制background的漸變(因爲font-size並沒有linear-gradient()的屬性)色,再將字體顏色置透明,那麼就可以達到想要的效果了。
代碼奉上:
.gradient-text {
font-size: 74rpx;
font-weight: bold;
background: linear-gradient(to right, #1ae8c8, #4a8aff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
效果: