css loading 动画

2019-04-24 09:52  61人阅读  评论 (0)
Tags: css3
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style>
        @keyframes loading {
            0%, 40%, 100% {
                transform: scaleY(1);
            }
            20% {
                transform: scaleY(2);
            }
        }
        .loading {
            padding: 20px;
            overflow: hidden;
        }
        .loading div {
            width: 5px;
            height: 20px;
            background-color: #6a6;
            display: inline-block;
            float: left;
            margin: 2px;
            animation: loading 1.2s infinite ease-in-out;
        }
        .loading>div:nth-child(1) {
            animation-delay: 0s;
        }
        .loading>div:nth-child(2) {
            animation-delay: 0.1s;
        }
        .loading>div:nth-child(3) {
            animation-delay: 0.2s;
        }
        .loading>div:nth-child(4) {
            animation-delay: 0.3s;
        }
        .loading>div:nth-child(5) {
            animation-delay: 0.4s;
        }
    </style>
</head>
<body>
    <div class="loading">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
</html>