css实现标题跑马灯效果

css实现标题跑马灯效果

javascript 复制代码
      <div class="topBar">
        <span class="scrolling-text">滚动字幕</span>
      </div>
javascript 复制代码
@keyframes marquee {
  0% {
    transform: translateX(300%);
  }

  100% {
    transform: translateX(-300%);
  }
}

  .topBar {
    width:100%;
    height: 45px;
    line-height: 45px;
    background: #FFE6CC;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    color: $fontCoco;
    overflow: hidden;
    position: relative;

    .scrolling-text {
      display: inline-block;
      white-space: nowrap;
      animation: marquee 30s linear infinite;
    }

    .scrolling-text:hover {
      animation-play-state: paused;
      cursor: pointer;
    }
  }
相关推荐
跟橙姐学代码1 分钟前
Python 装饰器超详细讲解:从“看不懂”到“会使用”,一篇吃透
前端·python·ipython
pany20 分钟前
体验一款编程友好的显示器
前端·后端·程序员
Zuckjet25 分钟前
从零到百万:Notion如何用CRDT征服离线协作的终极挑战?
前端
ikonan30 分钟前
译:Chrome DevTools 实用技巧和窍门清单
前端·javascript
Juchecar30 分钟前
Vue3 v-if、v-show、v-for 详解及示例
前端·vue.js
ccc101834 分钟前
通过学长的分享,我学到了
前端
编辑胜编程34 分钟前
记录MCP开发表单
前端
可爱生存报告34 分钟前
vue3 vite quill-image-resize-module打包报错 Cannot set properties of undefined
前端·vite
__lll_34 分钟前
前端性能优化:Vue + Vite 全链路性能提升与打包体积压缩指南
前端·性能优化
weJee35 分钟前
pnpm原理
前端·前端工程化