
利用css3background-clip
属性:
background-clip: border-box || padding-box || context-box || no-clip || text
CSS代码(里面渐变颜色可以自己修改)
.jb{
font-size: 16px;
background-image: -webkit-linear-gradient(90deg, #4e17df, #fb6bea 25%, #4e17df 50%, #fb6bea 75%, #4e17df);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-size: 100% 600%;
animation: jb 10s linear infinite;
}
@keyframes jb {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -300%;
}
}
然后在你的标签里加入class="jb",例如
<div class="jb">欢迎来到MDP BLOG!</div>
下面是演示
欢迎来到MDP BLOG!
暂无评论