首页 > Web开发 > 详细

css3实现div自动左右动

时间:2019-10-28 14:39:34      阅读:222      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <meta charset="UTF-8"/>
 3 <html>
 4 
 5     <head>
 6         <style>
 7             div {
 8                 width: 100px;
 9                 height: 100px;
10                 background: red;
11                 position: relative;
12                 animation: myfirst 5s infinite alternate;
13             }
14             
15             @keyframes myfirst {
16                 0% {
17                     background: red;
18                     left: 0px;
19                     top: 0px;
20                 }
21             
22                 100% {
23                     background: blue;
24                     left: 200px;
25                     top: 0px;
26                 }
27                 
28             }
29             //鼠标划过停止动画效果
30             div:hover{
31                  -webkit-animation-play-state:paused;
32                  animation-play-state:paused;
33             }
34         </style>
35     </head>
36     <body>
37         <div></div>
38     </body>
39 
40 </html>

 

css3实现div自动左右动

原文:https://www.cnblogs.com/520yh/p/11751576.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!