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>
相关推荐
做前端的娜娜子1 小时前
同一链接实现 PC Web 与移动 H5 自适应
前端·掘金·金石计划
小帅不太帅1 小时前
架构没变、规模没变,DeepSeek V4 Flash 正式版凭什么暴涨 47 分?
前端·aigc·deepseek
jarvisuni2 小时前
DeepSeekFlash前端依旧拉垮,而且变慢了很多!
前端·javascript·算法
卷福同学3 小时前
AI编程出海第二步:验证关键词能否做站
前端·人工智能·后端
开普勒chr3 小时前
css样式diaplay:"contents"的妙用
css
赵庆明老师3 小时前
Vben精讲:21-详解web-antd:tsconfig.json
前端·json·vim
wc883 小时前
微软EDGE浏览器功能学习
前端·学习·edge
破z晓3 小时前
javascript 导出excel表
开发语言·javascript·excel
Csvn4 小时前
🎯 原生 `<dialog>` 元素:终于可以扔掉一半的自定义弹窗组件了?
前端