横向滚动示例

html

<div class="marquee">
    <div class="marquee-wrap" style="width: 430px;text-align: center">
        <span
              class="yellow marquee-content">这是一断横向滚动的文字</span>
    </div>
</div>

css

.marquee {
    overflow: hidden;
}

.marquee .marquee-wrap {
    width: 100%;
    animation: marquee-wrap 4s infinite linear;
}

.marquee .marquee-content {
    float: left;
    white-space: nowrap;
    min-width: 100%;
    animation: marquee-content 4s infinite linear;
}

@keyframes marquee-wrap {
    0%,
    30% {
        transform: translateX(0);
    }
    70%,
    100% {
        transform: translateX(100%);
    }
}

@keyframes marquee-content {
    0%,
    30% {
        transform: translateX(0);
    }
    70%,
    100% {
        transform: translateX(-100%);
    }
}

实现效果

横向滚动

纵向滚动示例

html

<div class="marquee-y">
    <div class="marquee-wrap-y" style="height: 330px;width:2360px;text-align: center">
        <span class="marquee-content-y"><mark class="zyyjxx-index">{{index+1}} 、</mark>{{item}}</span>
    </div>
</div>

css

.marquee-y {
    overflow: hidden;
}

.marquee-y .marquee-wrap-y {
    height: 100%;
    animation: marquee-wrap-y 4s infinite linear;
}

.marquee-y .marquee-content-y {
    float: left;
    min-height: 100%;
    max-width: 100%;
    white-space: pre-wrap;
    animation: marquee-content-y 4s infinite linear;
}

@keyframes marquee-wrap-y {
    0%,
    30% {
        transform: translateY(0);
    }
    70%,
    100% {
        transform: translateY(100%);
    }
}

@keyframes marquee-content-y {
    0%,
    30% {
        transform: translateY(0);
    }
    70%,
    100% {
        transform: translateY(-100%);
    }
}

实现效果

纵向向滚动