css实现跑马灯(电子屏滚动)效果

html 复制代码
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Marquee</title>
    <style>
      .marquee {
        margin-left: 100px;
        width: 300px;
        white-space: nowrap;
        overflow: hidden;
        border: 1px solid #4c7cee;
      }
      .marquee-txt {
        display: inline-block;
        padding-left: 100%; /* 从右至左开始滚动 */
        animation: marqueeAnimation 4s linear infinite;
      }
      @keyframes marqueeAnimation {
        0% {
          transform: translate(0, 0);
        }
        100% {
          transform: translate(-100%, 0);
        }
      }
    </style>
  </head>

  <body>
    <div class="marquee">
      <span class="marquee-txt">css实现跑马灯(电子屏滚动)效果</span>
    </div>
  </body>
</html>
相关推荐
冬奇Lab几秒前
AI Workflow 定义的四次演进:从 Markdown 到 JS 脚本,再到分布式多 Agent
javascript·人工智能·agent
zhangxingchao9 分钟前
Kotlin常用的Flow 操作符整理
前端
IT_陈寒2 小时前
React的useState居然还有这种坑?我差点删库跑路
前端·人工智能·后端
Pedantic3 小时前
SwiftUI 手势笔记
前端·后端
橙子家3 小时前
浏览器缓存之【结构化数据库与缓存】: IndexedDB、Cache storage 和 Storage buckets
前端
user20585561518133 小时前
X6 中边悬浮置顶,规避 `mouseleave` 事件丢失问题
前端
李明卫杭州3 小时前
CSS aspect-ratio 属性完全指南
前端
Pedantic5 小时前
SwiftUI 手势层级(Gesture Hierarchy)详解
前端
飘尘6 小时前
前端转型全栈(Java后端)的快速上手指引
前端·后端·全栈