css3文字颜色从左到右动画

本文介绍了一种使用HTML和CSS实现的滑块解锁效果。通过定义特定的样式和动画,使得滑块能够响应用户的拖动操作,并在拖动到指定位置时完成解锁动作。

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>

转载于:https://www.cnblogs.com/lcosima/p/9364915.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值