css 简单动画

作者: 阿巳交不起水电费 | 来源:发表于2022-03-26 14:43 被阅读0次

    效果图:


    animate.gif

    代码:

    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport"
              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>css动画</title>
        <style>
            *{
                margin:0;
                padding:0;
            }
            .wrap{
                position: relative;
                width:300px;
                margin:150px auto;
                overflow: hidden;
                height:50px;
                line-height:50px;
                background: #cccccc;
                transform: skewX(10deg) skewY(-10deg);
            }
    
            .animate-wap{
                height: 100%;
                width: 200%;
                position: absolute;
                right: 0;
                top: 0;
                animation: 5s move infinite linear;
            }
    
            .box{
                height: 100%;
                float: left;
                width:50%;
                text-align: center;
                position: relative;
            }
            .box >span{
                display: block;
                width:20%;
                text-align: center;
                background: #FF8025;
            }
    
            @keyframes move {
                0% {
                    right: 0;
                }
                100% {
                    right: -100%;
                }
            }
        </style>
    </head>
    <body>
    <div class="wrap">
        <div class="animate-wap">
            <div class="box"> <span>box</span> </div>
            <div class="box"> <span>box</span> </div>
        </div>
    </div>
    
    </body>
    </html>
    ···

    相关文章

      网友评论

        本文标题:css 简单动画

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