美文网首页
loading小练习

loading小练习

作者: qianxun0921 | 来源:发表于2018-09-13 13:12 被阅读0次

HTML代码:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="css/loading.css"/>
    </head>
    <body>
        <div class="box">
            <div class="box1"></div>
            <div class="box2"></div>
            <div class="box3"></div>
            <div class="box4"></div>
            <div class="box5"></div>
            <p class="loading">loading...</p>
        </div>
    </body>
</html>

css代码如下:

*{
    padding: 0;
    margin: 0;
}
.box{
    width: 500px;
    height: 300px;
    display: block;
    border: 1px solid black;
    margin: 50px auto;
}
.box1{
    width: 75px;
    height: 100px;
    background-color: red;
    border: 1px solid #e8e8e8;
    float: left;
    margin: 90px 10px;
    border-radius:50%;
}
.box2{
    width: 75px;
    height: 100px;
    background-color: orange;
    border: 1px solid #e8e8e8;
    float: left;
    margin: 90px 10px;
    border-radius:50%;
}
.box3{
    width: 75px;
    height: 100px;
    background-color: yellow;
    border: 1px solid #e8e8e8;
    float: left;
    margin: 90px 10px;
    border-radius:50%;
}
.box4{
    width: 75px;
    height: 100px;
    background-color: green;
    border: 1px solid #e8e8e8;
    float: left;
    margin: 90px 10px;
    border-radius:50%;
}
.box5{
    width: 75px;
    height: 100px;
    background-color: skyblue;
    border: 1px solid #e8e8e8;
    float: left;
    margin: 90px 10px;
    border-radius:50%;
}
@keyframes scale{
    from{
        transform: scaleY(1);
    }
    to{
        transform: scaleY(0.5);
    }
}
.box1{
    animation: scale 0.5s ease 1.1s infinite alternate both;
}
.box2{
    animation: scale 0.5s ease 1.2s infinite alternate both;
}
.box3{
    animation: scale 0.5s ease 1.3s infinite alternate both;
}
.box4{
    animation: scale 0.5s ease 1.4s infinite alternate both;
}
.box5{
    animation: scale 0.5s ease 1.5s infinite alternate both;
}
.loading{
    text-align: center;
    
}

显示效果如下:


5.png

相关文章

网友评论

      本文标题:loading小练习

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