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