您现在的位置:首页 >> 前端 >> 内容

CSS3中,loading加载动画的代码实例教程

时间:2018/1/23 14:07:22 点击:

  核心提示:CSS3中,loading加载动画!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-8titleloading-加载动画/titlestyle type=te...

CSS3中,loading加载动画

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>loading-加载动画</title>
    <style type="text/css">
        .box{
            width: 300px;
            height: 130px;
            border: 1px solid #000;
            margin: 200px auto 0;
        }

        .box p{
            text-align: center;
            width: 100%;
            float: left;
            margin: 0;
            padding: 0;
        }

        .box p{
            width: 30px;
            height: 70px;
            float: left;;
            background-color: gold;
            margin:15px;
            border-radius: 12%;
        }

        .box p:nth-child(1){
            background-color: #cecece;
            animation: loading 500ms ease 0s  infinite alternate;
        }

        .box p:nth-child(2){
            background-color: pink;
            animation: loading 500ms ease 100ms  infinite alternate;
        }

        .box p:nth-child(3){
            background-color: orange;
            animation: loading 500ms ease 200ms  infinite alternate;
        }

        .box p:nth-child(4){
            background-color: red;
            animation: loading 500ms ease 300ms  infinite alternate;
        }

        .box p:nth-child(5){
            background-color: green;
            animation: loading 500ms ease 400ms  infinite alternate;
        }

        @keyframes loading{
            from{
                transform: scaleY(1.2);
            }

            to{
                transform: scaleY(0.2);
            }
        }

    </style>
</head>
<body>
    <p class="box">
        <p></p>
        <p></p>
        <p></p>
        <p></p>
        <p></p>
        <p> Loading...</p>
    </p>
</body>
</html>

结果如下:

CSS3中,loading加载动画的代码实例教程

Tags:CS SS S3 3中 
作者:网络 来源:mr_muli的博客