您的位置:首页 > Web前端 > CSS

CSS3实现文字流光渐变特效

2017-12-12 09:27 597 查看
制作流光文字有几个要点:text-fill-color一般设置为transparent(透明色),然后利用background-image和渐变颜色来设置文字的背景色,利用background-clip来实现文字的截取,再利用background-size设置扩大背景,已使运用animation的时候能达到动画的效果等。

<!DOCTYPE html>
<html
lang="en">
<head>
<meta
charset="UTF-8">
<title>Title</title>
<style>
._borderWrap{
width: 180px;
height: 150px;
position: absolute;
left: 23%;
top: 25%;
}
._border{
line-height:
145px;
text-align: center;
font-size: 40px;
font-weight:
bolder;
-webkit-text-fill-color:
transparent;
background-image:
-webkit-linear-gradient(left,#129835,#ece64825%,#12983550%,#F9E92B75%,rgb(40,150,38));
background-size:
200%,100%;
-webkit-background-clip:text;
-webkit-animation: word
5s linear infinite ;
}
@keyframes word {
0%{background-position:
0 0}
100%{background-position:
-100% 0}
}

</style>
</head>
<body>
<div
class="_borderWrap">
<div
class="_border">流光字体</div>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息