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>
相关推荐
BillKu1 小时前
js前端对时间进行格式处理
前端
小满zs2 小时前
React-router v7 第三章(路由)
前端·react.js
Kx…………5 小时前
Day2:前端项目uniapp壁纸实战
前端·学习·uni-app·实战·项目
gqkmiss6 小时前
Git Cherry-pick:核心命令、实践详解
前端·git·前端框架·commit·cherry-pick
不想上班只想要钱6 小时前
vue面试题
前端·javascript·vue.js
拉不动的猪6 小时前
简单回顾下es6增数组方法
前端·javascript·面试
Alkaid:7 小时前
解决Long类型前端精度丢失和正常传回后端问题
java·前端·javascript·vue.js
Code额7 小时前
Vue 框架组件间通信方式
前端·vue.js·前端框架
玖玖passion7 小时前
即时响应之道:深入浅出Server-Sent Events
前端
无名之逆8 小时前
[特殊字符] Hyperlane:Rust 高性能 HTTP 服务器库,开启 Web 服务新纪元!
java·服务器·开发语言·前端·网络·http·rust