css3animation动画

本文深入探讨了CSS3动画的核心概念,通过实例展示了如何使用关键帧动画实现复杂的动态效果。从动画的基本原理到高级应用,一文带你掌握CSS3动画的精髓。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html>
<html lang="en">
<head>
<title>css3animation动画</title>
<meta charset="utf-8" />
<style type="text/css">
@keyframes alt{
0% {background-color: red;left:400px;top:0px;}
25% {background-color: blue;left:800px;top:0px;}
50% {background-color: green;left:800px;top:400px;}
75% {background-color: purple;left:400px;top:400px;}
100% {background-color: pink;left:400px;top:0px;}
}
@-webkit-keyframes alt{ /*Safari 和 Chrome*/
0% {background-color: red;left:400px;top:0px;}
25% {background-color: blue;left:800px;top:0px;}
50% {background-color: green;left:800px;top:400px;}
75% {background-color: purple;left:400px;top:400px;}
100% {background-color: pink;left:400px;top:0px;}
}
@-moz-keyframes alt{ /*Firefox*/
0% {background-color: red;left:400px;top:0px;}
25% {background-color: blue;left:800px;top:0px;}
50% {background-color: green;left:800px;top:400px;}
75% {background-color: purple;left:400px;top:400px;}
100% {background-color: pink;left:400px;top:0px;}
}
@-o-keyframes alt{ /*Opera*/
0% {background-color: red;left:400px;top:0px;}
25% {background-color: blue;left:800px;top:0px;}
50% {background-color: green;left:800px;top:400px;}
75% {background-color: purple;left:400px;top:400px;}
100% {background-color: pink;left:400px;top:0px;}
}


.d{
text-align: center;
position: relative;
padding:5px;
width: 100px;
border: 1px solid  #5D81AB;
border-radius: 10px;
animation: alt 5s linear  infinite alternate; /* Firefox: */
-moz-animation: alt 5s linear  infinite alternate; /* Safari 和 Chrome: */
-webkit-animation: alt 5s linear  infinite alternate; /* Opera: */
-o-animation: alt 5s linear  infinite alternate;
  }
 
</style>
<script type="text/javascript">
</script>
</head>
<body>
<div class="d">animation动画</div>
<div class="d"></div>

</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值