css3文字颜色从左到右动画


1、代码

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.test {
width: 428px;
height: 32px;
border: 1px solid black;
text-align: center;
}

#gradent {
background: -webkit-gradient(linear, left top, right top, color-stop(0, #4d4d4d), color-stop(.4, #4d4d4d), color-stop(.5, #fff), color-stop(.6, #4d4d4d), color-stop(1, #4d4d4d));
/*-webkit-text-fill-color: transparent;*/
-webkit-animation: slidetounlock 3s infinite;
line-height: 32px;
display: inline-block;
width: 200px;
}

@keyframes slidetounlock {
0% {
background-position: -100px 0
}
100% {
background-position: 100px 0
}
}
</style>
</head>
<body>
<div onclick="test()" class="test">
<span id="gradent">请按住滑块,拖动到最右边</span></div>

</body>
</html>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM