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>
相关推荐
Penge6668 小时前
《Go 后端开发者学 TypeScript:数组和元组》
javascript
Penge6668 小时前
《Go 后端开发者学 TypeScript:export关键字大全》
javascript
Penge6668 小时前
《Go 后端开发者学 TypeScript:从零理解 async、await 与 Promise》
javascript
Penge6669 小时前
typescript 中const用法
javascript
Csvn9 小时前
Monorepo
前端
Csvn9 小时前
流水线
前端
Csvn9 小时前
微前端架构
前端
Linux-lucky11 小时前
45-Linux学习之旅之防火墙与WEB加固
linux·前端·网络·学习·ubuntu
风骏时光牛马13 小时前
生成一个移动端标题,只需要一个标题,不需要其他的任何文本。
前端
IT_陈寒13 小时前
Redis雪崩把我坑惨了,这是5年经验的教训
前端·人工智能·后端