CSS - 实现Loading加载动画

Loading加载动画
用CSS都用实现一个loading的加载动画
通过控制 item-loader-container 来实现显示及隐藏


在这里插入图片描述

	<div class="item-loader-container" id="item-loader-container">
	    <div class="la-ball-running-dots la-2x">
	        <div></div><div></div><div></div><div></div><div></div>
	    </div>
	</div>
	<style>
		.item-loader-container{
			position: absolute;left: 42%;top: 52%;opacity: .7;
		}
	    .item-loader-container div {
	    	-webkit-animation-play-state: paused;
	    	-moz-animation-play-state: paused;
	    	-o-animation-play-state: paused;
	    	animation-play-state: paused;
	    }
	    .la-ball-elastic-dots { 
	    	width: 120px;height: 10px;
	    	font-size: 0;text-align: center;
	    }
	    .la-ball-elastic-dots, .la-ball-elastic-dots>div { 
	    	position: relative;-webkit-box-sizing: border-box;
	    	-moz-box-sizing: border-box;box-sizing: border-box;
	    }
	    .la-ball-elastic-dots.la-2x {
	    	color: #6f6f70;opacity: .8;font-size: 3px;
	    	width: 186px;height: 15px;
	    }
	    .la-ball-elastic-dots.la-2x>div {
	    	width: 15px;height: 15px;
	    }
	    .la-ball-elastic-dots>div {
	    	display: inline-block;width: 10px;height: 10px;
	    	white-space: nowrap;border-radius: 100%;
	    	-webkit-animation: ball-elastic-dots-anim 1s infinite;
	    	-moz-animation: ball-elastic-dots-anim 1s infinite;
	    	-o-animation: ball-elastic-dots-anim 1s infinite;
	    	animation: ball-elastic-dots-anim 1s infinite;
	    }
	    .la-ball-elastic-dots>div {
	    	display: inline-block;float: none;
	    	background-color: currentColor;
	    	border: 0 solid currentColor;
	    }
	    @keyframes ball-elastic-dots-anim {
	        0%, 100% {
	        	-webkit-transform: scale(1);-moz-transform: scale(1);
	        	-o-transform: scale(1);transform: scale(1);margin: 0;
	        }
	        50% {
	        	-webkit-transform: scale(0.65);-moz-transform: scale(0.65);
	        	-o-transform: scale(0.65);transform: scale(0.65);margin: 0 5%;
	        }
		</style>

PS:当然也可以使用GIF图,做加载过度 例如:
请添加图片描述 请添加图片描述请添加图片描述

  • 27
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值