CSS实现的弹幕效果

<!DOCTYPE html>

<html>

 

<head>

    <meta charset="utf-8">

    <title>CSS实现的弹幕效果</title>

    <script src="js/jquery-3.4.1.min.js"></script>

    <style>

        body {

            background-color: white;

            background-image:

                radial-gradient(hsla(0, 0%, 87%, 0.31) 9px, transparent 10px),

                repeating-radial-gradient(hsla(0, 0%, 87%, 0.31) 0,

                    hsla(0, 0%, 87%, 0.31) 4px, transparent 5px,

                    transparent 20px, hsla(0, 0%, 87%, 0.31) 21px,

                    hsla(0, 0%, 87%, 0.31) 25px, transparent 26px,

                    transparent 50px);

            background-size: 30px 30px, 90px 90px;

            background-position: 0 0;

            display: flex;

            justify-content: center;

            align-items: center;

            height: 100%;

        }

 

        .container {

            display: flex;

            flex-direction: column;

            width: 800px;

            height: 500px;

            /* justify-content: center; */

            border: 1px solid red;

            text-align: center;

            overflow: hidden;

        }

 

        .item {

            height: 30px;

            /* border: 1px solid skyblue; */

        }

 

        .item-1 {

            color: brown;

            text-shadow: 2px 2px 3px rgb(248, 81, 20);

            transform: translateX(1000px);

            animation: scrollTo linear 4s infinite;

        }

 

        .item-2 {

            color: rgb(127, 197, 35);

            text-shadow: 2px 2px 3px rgb(173, 255, 80);

            transform: translateX(1050px);

            animation: scrollTo linear 7s infinite;

        }

 

        .item-3 {

            color: coral;

            text-shadow: 2px 2px 3px coral;

            transform: translateX(800px);

            animation: scrollTo linear 5s infinite;

        }

 

        @keyframes scrollTo {

            to {

                transform: translateX(-500px);

            }

        }

    </style>

</head>

 

<body>

    <div class="container">

        <div class="item item-1">弹幕1 您的好友老佛爷邀请你视频</div>

        <div class="item item-2">弹幕2 when u say nothing at all</div>

        <div class="item item-3">弹幕3 小英英 好好看</div>

    </div>

</body>

<script>

 

</script>

 

</html>

转自 https://blog.csdn.net/jbj6568839z/article/details/103344345

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值