美文网首页
css纵向无缝滚动

css纵向无缝滚动

作者: AMONTOP | 来源:发表于2019-02-20 11:31 被阅读0次

来自https://www.jianshu.com/p/168888e8f568的图

image
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>marquee</title>
    <style>
        @-webkit-keyframes scrollText1 {
            0%{
                -webkit-transform: translateY(0px);
            }
            20%{
                -webkit-transform: translateY(-30px);
            }
            40%{
                -webkit-transform: translateY(-60px);
            }
            60%{
                -webkit-transform: translateY(-90px);
            }
            80%{
                -webkit-transform: translateY(-120px);
            }
            100%{
                -webkit-transform: translateY(-150px);
            }
        }

        @keyframes scrollText1 {
            0%{
                transform: translateY(0px);
            }
            20%{
                transform: translateY(-30px);
            }
            40%{
                transform: translateY(-60px);
            }
            60%{
                transform: translateY(-90px);
            }
            80%{
                transform: translateY(-120px);
            }
            100%{
                transform: translateY(-150px);
            }
        }

        .box3{
            position: relative;
            top: 20px;
            left: 20px;
            width: 200px;
            height: 120px;
            overflow: hidden;
            border:1px solid #ccc;
        }

        .border3{
            top: 0px;
            -webkit-animation:scrollText1 8s infinite  cubic-bezier(1,0,0.5,0) ;
            animation:scrollText1 8s infinite  cubic-bezier(1,0,0.5,0) ;
        }

        .border3 div{
            height: 30px;
        }

        .border3:hover{
            animation-play-state:paused;
            -webkit-animation-play-state:paused;
        }
    </style>
</head>
<body>
    <div class="box3">
        <div class="border3">
            <div>This is a test 1.</div>
            <div>This is a test 2.</div>
            <div>This is a test 3.</div>
            <div>This is a test 4.</div>
            <div>This is a test 5.</div>

            <div>This is a test 1.</div>
            <div>This is a test 2.</div>
            <div>This is a test 3.</div>
            <div>This is a test 4.</div>
            <div>This is a test 5.</div>

        </div>
    </div>
</body>

</html>


相关文章