双层文字扫光效果

文字扫光效果

html 复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>Animated Shiny Text -- Correct</title>

<style>
  body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0b0b0b;
    font-family: system-ui, -apple-system, BlinkMacSystemFont;
  }

  .shiny-wrapper {
    position: relative;
    font-size: 64px;
    font-weight: 700;
    line-height: 1.2;
  }

  /* 底层文字(永远可见) */
  .shiny-base {
    color: rgba(229, 231, 235, 0.7);
  }

  /* 上层扫光 */
  .shiny-overlay {
    position: absolute;
    inset: 0;
    color: transparent;

    background-image: linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.9),
      transparent
    );
    background-repeat: no-repeat;
    background-size: 120px 100%;
    background-position: 0 0;

    -webkit-background-clip: text;
    background-clip: text;

    animation: shine 1.5s linear infinite;
    pointer-events: none;
  }

  @keyframes shine {
  from {
    background-position: -120% 0;
  }
  to {
    background-position: 220% 0;
  }
}
</style>
</head>

<body>

<div class="shiny-wrapper">
  <span class="shiny-base">Animate</span>
  <span class="shiny-overlay">Animate</span>
</div>

</body>
</html>
相关推荐
凯瑟琳.奥古斯特9 小时前
Bootstrap快速上手指南
开发语言·前端·css·bootstrap·html
精益数智工坊9 小时前
拆解制造业仓库物料管理流程:如何通过标准化仓库物料管理流程解决账实不符难题
大数据·前端·数据库·人工智能·精益工程
恶猫9 小时前
网页自动化模拟操作时,模拟真实按键触发事件【终级方案】
前端·javascript·自动化·vue·网页模拟
小羊Yveesss10 小时前
2026年前端开发新趋势:智能协同、工具革新与场景深耕
前端·ai
Dxy123931021610 小时前
HTML中的Canvas可以干哪些事情
前端·html
悟乙己10 小时前
解析 Agent 时代的 HTML PPT SKILLS: html-ppt-skill
前端·html·powerpoint
ZC跨境爬虫10 小时前
跟着 MDN 学 HTML day_2:(表单分组与高级输入控件实战)
前端·javascript·css·ui·html
ppandss111 小时前
JavaWeb从0到1-DAY4-AJAX
前端·ajax·okhttp
千寻girling11 小时前
滑动窗口刷了快一个月(26天)了 , 还没有刷完. | 含(操作系统学什么的Java 后端)
java·开发语言·javascript·c++·人工智能·后端·python
一袋米扛几楼9811 小时前
【报错问题】彻底解决 TypeScript 报错 TS2769: No overload matches this call (JWT 篇)
linux·javascript·typescript