【CSS3动画】条状的加载中的动画效果

原创,转载请注明出处,谢谢

 昨天看到这么一张gif图,然后今天试了试做成了动画,纯CSS3实现,不支持IE9及以下。

 缺点:

  1. 木有效果图诶,只能您自己动手建个文件看一下咯~
  2. 延迟我只想到了分开定义,对于数量多的情况下似乎就不太友好了。。。写个js可以实现,暂时没想到纯的CSS的解决办法

 

 1 <!DOCTYPE html>
 2 <html>
 3 
 4     <head>
 5         <meta charset="UTF-8">
 6         <title></title>
 7         <style>
 8             .boxcontainer 
 9             {
10                 align-items: center;
11                 width: 100px;
12                 height: 30px;
13                 display: -webkit-box;
14                 display: flex;
15                 -moz-box-orient: horizontal;
16                 -webkit-box-orient: horizontal;
17             }
18             .item 
19             {
20                 background-color: black;
21                 margin: 1px;
22                 color: #fff;
23                 padding: 0 3px;
24                 height: 30px;
25                 -moz-animation:  go 1s infinite;
26                 -ms-animation: go 1s infinite;
27                 -webkit-animation: go 1s infinite;
28             }
29             @-moz-keyframes go {
30                 0% {height: 30px;}
31                 50% {height: 60px;}
32                 100% {height: 30px;}
33             }
34             @-ms-keyframes go {
35                 0% {height: 30px;}
36                 50% {height: 60px;}
37                 100% {height: 30px;}
38             }
39             @-webkit-keyframes go {
40                 0% {height: 30px;}
41                 50% {height: 60px;}
42                 100% {height: 30px;}
43             }
44             #d1
45             {
46                 -webkit-animation-delay: .2s;
47                 -moz-animation-delay: .2s;
48                 -ms-animation-delay: .2s;
49             }
50             #d2
51             {
52                 -webkit-animation-delay: .4s;
53                 -moz-animation-delay: .4s;
54                 -ms-animation-delay: .5s;
55             }
56             #d3
57             {
58                 -webkit-animation-delay: .6s;
59                 -moz-animation-delay: .6s;
60                 -ms-animation-delay: .6s;
61             }
62             #d4
63             {
64                 -webkit-animation-delay: .8s;
65                 -moz-animation-delay: .8s;
66                 -ms-animation-delay: .8s;
67             }
68         </style>
69     </head>
70     <body>
71         <div style="height: 20px;"></div>
72         <div class="boxcontainer">
73             <div class="item">
74             </div>
75             <div class="item" id="d1">
76             </div>
77             <div class="item" id="d2">
78             </div>
79             <div class="item" id="d3">
80             </div>
81             <div class="item" id="d4">
82             </div>
83         </div>
84     </body>
85 </html>

 

转载于:https://www.cnblogs.com/hmj1216/articles/6248867.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值