CSS文字渐变效果

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gradient Text Example</title>
<style>
  body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
  }

  .gradient-text {
    font-size: 4rem;
    font-weight: bold;
    background-image: linear-gradient(45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent; /* 使文字颜色透明,以显示背景 */
    /* animation: moveGradient 3s ease infinite; */
  }

  @keyframes moveGradient {
    0% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
    100% {
      background-position: 0% 50%;
    }
  }
</style>
</head>
<body>

<h1 class="gradient-text">渐变文字效果</h1>

</body>
</html>
相关推荐
江城开朗的豌豆5 分钟前
从 JavaScript 到 TypeScript:我为什么选择了类型守护
前端·javascript
CoovallyAIHub12 分钟前
Cursor 2.0 太离谱了!8 个 AI 同时写代码,还能自己测!
css·后端·程序员
杨超越luckly21 分钟前
HTML应用指南:利用POST请求获取全国爱回收门店位置信息
大数据·前端·python·信息可视化·html
冷崖1 小时前
QML-Model-View
javascript·c++
鹏多多1 小时前
解锁flutter弹窗新姿势:dialog-flutter_smart_dialog插件解读+案例
前端·flutter·客户端
IT_陈寒1 小时前
Redis 7.0的这个新特性让我处理百万级QPS轻松了50%,你可能还不知道!
前端·人工智能·后端
2301_796512521 小时前
Rust编程学习 - 如何快速构建一个单线程 web server
前端·学习·rust
蒜香拿铁1 小时前
Angular【核心特性】
前端·javascript·angular.js
天天向上10241 小时前
vue3 css使用v-bind实现动态样式
前端·css·vue.js
艾小码1 小时前
前端新手必看!困扰90%人的10个JavaScript问题,一次性帮你解决
前端·javascript