CSS Loading 效果合集

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS Loading 效果合集</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: #f5f5f5;
            margin: 0;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
        }
        
        h1 {
            color: #333;
            margin-bottom: 30px;
        }
        
        .loading-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 40px;
            max-width: 1000px;
        }
        
        .loader-box {
            background: white;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
            width: 200px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .loader-title {
            margin-top: 10px;
            font-size: 14px;
            color: #666;
        }
        
        /* 旋转圆圈加载动画 */
        .spinner {
            width: 50px;
            height: 50px;
            border: 5px solid #f3f3f3;
            border-top: 5px solid #3498db;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* 跳动圆点加载动画 */
        .dot-flashing {
            position: relative;
            width: 10px;
            height: 10px;
            border-radius: 5px;
            background-color: #2ecc71;
            color: #2ecc71;
            animation: dot-flashing 1s infinite linear alternate;
            animation-delay: 0.5s;
        }
        
        .dot-flashing::before, .dot-flashing::after {
            content: '';
            display: inline-block;
            position: absolute;
            top: 0;
            width: 10px;
            height: 10px;
            border-radius: 5px;
            background-color: #2ecc71;
            color: #2ecc71;
        }
        
        .dot-flashing::before {
            left: -15px;
            animation: dot-flashing 1s infinite alternate;
            animation-delay: 0s;
        }
        
        .dot-flashing::after {
            left: 15px;
            animation: dot-flashing 1s infinite alternate;
            animation-delay: 1s;
        }
        
        @keyframes dot-flashing {
            0% { background-color: #2ecc71; }
            50%, 100% { background-color: rgba(46, 204, 113, 0.2); }
        }
        
        /* 波浪加载动画 */
        .wave-loader {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 50px;
        }
        
        .wave-loader div {
            width: 6px;
            height: 30px;
            margin: 0 3px;
            background-color: #e74c3c;
            animation: wave 1.2s infinite ease-in-out;
        }
        
        .wave-loader div:nth-child(1) { animation-delay: -1.2s; }
        .wave-loader div:nth-child(2) { animation-delay: -1.1s; }
        .wave-loader div:nth-child(3) { animation-delay: -1.0s; }
        .wave-loader div:nth-child(4) { animation-delay: -0.9s; }
        .wave-loader div:nth-child(5) { animation-delay: -0.8s; }
        
        @keyframes wave {
            0%, 40%, 100% { transform: scaleY(0.4); } 
            20% { transform: scaleY(1); }
        }
        
        /* 进度条加载动画 */
        .progress-loader {
            width: 150px;
            height: 4px;
            background: #ddd;
            border-radius: 2px;
            overflow: hidden;
        }
        
        .progress-loader::after {
            content: '';
            display: block;
            width: 150px;
            height: 4px;
            background: #9b59b6;
            border-radius: 2px;
            animation: progress 2s linear infinite;
        }
        
        @keyframes progress {
            0% { transform: translateX(-150px); }
            100% { transform: translateX(150px); }
        }
        
        /* 旋转方块加载动画 */
        .cube-loader {
            width: 50px;
            height: 50px;
            position: relative;
            transform: rotateZ(45deg);
        }
        
        .cube-loader .cube {
            position: relative;
            transform: rotateZ(45deg);
            width: 50%;
            height: 50%;
            float: left;
            transform: scale(1.1);
        }
        
        .cube-loader .cube::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #f39c12;
            animation: cube-fold 2.4s infinite linear both;
            transform-origin: 100% 100%;
        }
        
        .cube-loader .cube-2 { transform: scale(1.1) rotateZ(90deg); }
        .cube-loader .cube-3 { transform: scale(1.1) rotateZ(180deg); }
        .cube-loader .cube-4 { transform: scale(1.1) rotateZ(270deg); }
        .cube-loader .cube-2::before { animation-delay: 0.3s; }
        .cube-loader .cube-3::before { animation-delay: 0.6s; }
        .cube-loader .cube-4::before { animation-delay: 0.9s; }
        
        @keyframes cube-fold {
            0%, 10% {
                transform: perspective(140px) rotateX(-180deg);
                opacity: 0;
            }
            25%, 75% {
                transform: perspective(140px) rotateX(0deg);
                opacity: 1;
            }
            90%, 100% {
                transform: perspective(140px) rotateY(180deg);
                opacity: 0;
            }
        }
        
        /* 脉冲加载动画 */
        .pulse-loader {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: #1abc9c;
            animation: pulse 1.5s infinite ease-in-out;
        }
        
        @keyframes pulse {
            0% { transform: scale(0); opacity: 1; }
            100% { transform: scale(1); opacity: 0; }
        }
        
        .footer {
            margin-top: 40px;
            font-size: 12px;
            color: #999;
        }
        
        .footer a {
            color: #3498db;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <h1>CSS Loading 效果合集</h1>
    
    <div class="loading-container">
        <div class="loader-box">
            <div class="spinner"></div>
            <div class="loader-title">旋转圆圈</div>
        </div>
        
        <div class="loader-box">
            <div class="dot-flashing"></div>
            <div class="loader-title">跳动圆点</div>
        </div>
        
        <div class="loader-box">
            <div class="wave-loader">
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
            </div>
            <div class="loader-title">波浪效果</div>
        </div>
        
        <div class="loader-box">
            <div class="progress-loader"></div>
            <div class="loader-title">进度条</div>
        </div>
        
        <div class="loader-box">
            <div class="cube-loader">
                <div class="cube cube-1"></div>
                <div class="cube cube-2"></div>
                <div class="cube cube-4"></div>
                <div class="cube cube-3"></div>
            </div>
            <div class="loader-title">旋转方块</div>
        </div>
        
        <div class="loader-box">
            <div class="pulse-loader"></div>
            <div class="loader-title">脉冲效果</div>
        </div>
    </div>
    

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值