css3 文字渐变色

实现文字变色,

参考网站:

https://www.cnblogs.com/webwangjie/p/10001482.html (主要参考)

https://www.php.cn/css-tutorial-408797.html  (三种方法)

因为涉及兼容模式,主观上比较倾向选择字体带color色,而不是透明色,最终代码:

.css3{    
    color: #fd4230;
    background-image: -webkit-gradient(linear, 0 0, right bottom, from(#ff884e), to(#fc2323));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;   
    /*background: -moz-linear-gradient(0 0, 0 bottom, #ff884e 0%, #fc2323 100%);  
    background: -webkit-linear-gradient(0 0, 0 bottom, #ff884e 0%, #fc2323 100%); 
    background: -o-linear-gradient(0 0, 0 bottom, #ff884e 0%, #fc2323 100%); 
    background: -ms-linear-gradient(0 0, 0 bottom, #ff884e 0%, #fc2323 100%); 
    background: linear-gradient(to bottom right, #ff884e 0%, #fc2323 100%); 
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff884e', endColorstr='#fc2323',GradientType=0 );*/
}

注释掉的部分是经过测试不兼容IE浏览器,Edge倒是支持,无奈只能注释掉了。

 

posted @ 2020-04-28 10:57  雲淡颩淸  阅读(338)  评论(0编辑  收藏  举报