CSS 实现简单的loading加载动画

CSS 实现简单的loading加载动画

全部代码: 

代码复制可直接使用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html, body{
            height: 100%;
            overflow: hidden;
            margin: 0;
        }
        .flex_div{
            margin: 0;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .animation_div{
            position: relative;
            width: 80px;
            height: 80px;
            border-radius: 50%;
            box-sizing: border-box;
            /* background: #ffff00; */
            line-height: 80px;
            text-align: center;
        }
        
        .animation_div::before {
            position: absolute;
            left: 0;
            top: 0;
            display: block;
            content: "";
            width: 80px;
            height: 80px;
            border-width: 1px;
            border-style: solid;
            border-color: #00ffff transparent transparent transparent;
            box-sizing: content-box;
            animation: trotate 1.5s linear infinite;
            border-radius: 50%;
            z-index: 2;
        }
        .animation_div::after {
            position: absolute;
            left: -3px;
            top: -3px;
            display: block;
            content: "";
            width: 86px;
            height: 86px;
            border-width: 1px;
            border-style: solid;
            border-color: #ff0000 transparent transparent transparent;
            box-sizing: content-box;
            animation: trotate 1s linear infinite;
            border-radius: 50%;
            z-index: 1;
        }
        @keyframes trotate {
            0%{
                transform: rotate(0);
            }
            25%{
                transform: rotate(90deg);
            }
            50%{
                transform: rotate(180deg);
            }
            75%{
                transform: rotate(270deg);
            }
            100%{
                transform: rotate(360deg);
            }
        }
    </style>
</head>
<body>
    <div class="flex_div">
        <div class="animation_div">加载中</div>
    </div>
</body>
</html>

使用场景: 如手机端网页进入页面loading,  PC端加载页等等。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值