css,js实现跑马灯效果

本文详细介绍了如何使用CSS、JavaScript以及jQuery来创建跑马灯效果,包括二维和三维的应用,提供了丰富的实现方法。
摘要由CSDN通过智能技术生成

 

一、二维跑马灯

1.css实现跑马灯效果

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			body {
				display: flex;
				flex-direction: row;
				justify-content: center;
			}

			#wrapper {
				position: relative;
				overflow: hidden;
				width: 25%;
				height: 100px;
				font-size: 20px;
				border: solid 1px #000000;
			}

			#horse {
				position: absolute;
				width: 100%;
				-webkit-animation: horse 3s linear 0s infinite;
			}

			@-webkit-keyframes horse {
				0% {
					left: 0%;
					top: 0px;
					background-color: lavenderblush;
				}

				47% {
					left: 105%;
					top: 0px;
				}

				48% {
					left: 105%;
					top: 100px;
				}

				49% {
					left: -105%;
					top: 100px;
				}

				50% {
					left: -100%;
					top: 0px;
					background-color: lightpink;
				}

				100% {
					left: 0%;
					top: 0px;
					background-color: #FFB6C1;
				}
			}
		</style>
		<script> </script>
	</head>
	<body>
		<div id="wrapper">
			<div id="horse"> <span> CSS3 </span> <span> 实现的跑马灯效果 </div> </span>
		</div>
	</body>
</html>

 

 

<!DOCTYPE html>
<html>
	<head>
		<meta char
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值