美文网首页
仅使用html和css制作炫酷的loading界面

仅使用html和css制作炫酷的loading界面

作者: 在阳光下睡觉 | 来源:发表于2021-01-19 15:55 被阅读0次

    效果预览

    loding.gif

    代码

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>loading animation</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <div class="loading-screen">
            <div class="loading">
                <span></span>
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>
    </body>
    </html>
    
    * {
        margin: 0;
        padding: 0;
    }
    
    .loading-screen {
        width: 100%;
        height: 100vh;
        background-color: #2e2e2e;
        position: fixed;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .loading {
        width: 80px;
        display: flex;
        flex-wrap: wrap;
        animation: rotate 1.5s linear infinite;
    }
    
    @keyframes rotate {
        to {
            transform: rotate(360deg)
        }
    }
    
    .loading span {
        width: 32px;
        height: 32px;
        background-color: red;
        margin: 4px;
        animation: scale 1.5s linear infinite;
    }
    
    @keyframes scale {
        50% {
            transform: scale(1.2);
        }    
    }
    
    .loading span:nth-child(1) {
        border-radius: 50% 50% 0 50%;
        background-color: #e77f67;
        transform-origin: bottom right;
    }
    
    .loading span:nth-child(2) {
        border-radius: 50% 50% 0 50%;
        background-color: #778beb;
        transform-origin: bottom right;
        animation-delay: .5s;
    }
    
    .loading span:nth-child(3) {
        border-radius: 50% 50% 0 50%;
        background-color: #f8a5c2;
        transform-origin: top right;
        animation-delay: 1.5s;
    }
    
    .loading span:nth-child(4) {
        border-radius: 0 50% 50% 50%;
        background-color: #f5cd79;
        transform-origin: top left;
        animation-delay: 1s;
    }
    
    

    相关文章

      网友评论

          本文标题:仅使用html和css制作炫酷的loading界面

          本文链接:https://www.haomeiwen.com/subject/nutczktx.html