使用css animation对两段文字添加上下无效滚动效果

<div className={style.invite}>
    <img src={inviteIcon} />
    <div className={style.invite_content_box}>
        <div className={`${style.invite_content_box_list}`}>
            <div className={`${style.item} ${style.item_1}`} onClick={handleJumpInvite}>
                邀请好友注册,享 <span>50</span> 条消息数
            </div>
            <div className={`${style.item} ${style.item_2}`}>新注册用户,免费体验三天</div>
            <div className={`${style.item} ${style.item_3}`} onClick={handleJumpInvite}>
                邀请好友注册,享 <span>50</span> 条消息数
            </div>
        </div>
    </div>
</div>



.invite {
    background: rgba(236, 7, 135, 0.30);
    height: 32px;
    line-height: 32px;
    overflow: hidden;
    margin-top: 12px;
    border-radius: 16px;

    > img {
        margin-right: 4px;
        margin-left: 8px;
    }

    .invite_content_box {
        margin-top: 48px;
        width: 208px;

        .invite_content_box_list {
            height: 72px;
            position: relative;
            animation: moreContentScroll 6s ease-out infinite;
            animation-delay: 2s;

            .item {
                position: absolute;
                width: 100%;
                height: 24px;
                line-height: 24px;

                color: #FFF;
                font-size: 14px;
                font-style: normal;
                font-weight: 400;
            }

            .item_1 {
                top: 0;
            }

            .item_2 {
                top: 24px;
            }

            .item_3 {
                top: 48px;
            }
        }
    }
}


@keyframes moreContentScroll{
    0% {
        transform: translateY(0);
    }
    5% {
        transform: translateY(-24px);
    }
    50% {
        transform: translateY(-24px);
    }
    55% {
        transform: translateY(-48px);
    }
    100% {
        transform: translateY(-48px);
    }
}

参考如下网址

c摄图网-正版高清图片免费下载_商用设计素材图库

相关推荐
Fan_web9 分钟前
jQuery——事件委托
开发语言·前端·javascript·css·jquery
安冬的码畜日常10 分钟前
【CSS in Depth 2 精译_044】第七章 响应式设计概述
前端·css·css3·html5·响应式设计·响应式
赛男丨木子丿小喵23 分钟前
visual studio2022添加新项中没有html和css
css·html·visual studio
莹雨潇潇1 小时前
Docker 快速入门(Ubuntu版)
java·前端·docker·容器
Jiaberrr1 小时前
Element UI教程:如何将Radio单选框的圆框改为方框
前端·javascript·vue.js·ui·elementui
Tiffany_Ho2 小时前
【TypeScript】知识点梳理(三)
前端·typescript
安冬的码畜日常3 小时前
【D3.js in Action 3 精译_029】3.5 给 D3 条形图加注图表标签(上)
开发语言·前端·javascript·信息可视化·数据可视化·d3.js
太阳花ˉ3 小时前
html+css+js实现step进度条效果
javascript·css·html
小白学习日记4 小时前
【复习】HTML常用标签<table>
前端·html