border动画

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
    </head>
    <style>
        body{
            background: #000;
        }
        .bb{
            position: relative;
            width: 200px;
            height: 200px;
            margin: 100px auto;
        }
        .bb:before,.bb:after{
            content: " ";
            display: block;
            position: absolute;
            width:220px;
            height:220px;
            top: -10px;
            left: -10px;
            border:2px solid #fff;
            z-index:10;
            box-sizing: border-box;
            -webkit-animation: clipAni 4s infinite linear;
        }
        .bb:before{
           -webkit-animation-delay: -2s;
        }
        @keyframes  clipAni{
            0%,100%{
                clip:rect(0px,220px,220px,217px);
            }
            25%{
                clip:rect(0px,220px,3px,0px);
            }
            50%{
                clip:rect(0px,3px,220px,0px);
            }
            75%{
                clip:rect(217px,220px,220px,0px);
            }            
        }
    </style>
    <body>
        <div class="cont">
            <div class="bb"></div>
        </div>
    </body>
</html>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容