代码 动态渐变背景

2024-11-19 01:49:50 +0800 CST views 907

该文本展示了一个使用HTML和CSS创建的动态渐变背景效果。通过CSS的背景剪裁和线性渐变,标题文字呈现出渐变动画,背景色为浅灰色,整个页面居中显示。使用了@keyframes定义动画,使背景在不同颜色之间平滑过渡,增强视觉效果。

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动态渐变背景</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        h1 {
            font-size: 5rem;
            color: transparent;
            -webkit-background-clip: text; /* Edge, Chrome */
            background-clip: text; /* Safari, FF */
            background-image: linear-gradient(45deg, #ffb3ba, #c49c6e, #bfbf76, #77b084, #ff7e74, #3b82f6, #c084fc, #db2777);
            background-size: 300% 100%;
            animation: gradientAnimation 8s linear infinite;
            animation-direction: alternate;
        }

        @keyframes gradientAnimation {
            0% {
                background-position: 0;
            }
            100% {
                background-position: 100%;
            }
        }
    </style>
</head>
<body>
    <h1>动起来的渐变背景</h1>
</body>
</html>

复制全文 生成海报 网页设计 前端开发 动画效果

推荐文章

php strpos查找字符串性能对比
2024-11-19 08:15:16 +0800 CST
Go 单元测试
2024-11-18 19:21:56 +0800 CST
Elasticsearch 条件查询
2024-11-19 06:50:24 +0800 CST
使用临时邮箱的重要性
2025-07-16 17:13:32 +0800 CST
Vue3中的Store模式有哪些改进?
2024-11-18 11:47:53 +0800 CST
GROMACS:一个美轮美奂的C++库
2024-11-18 19:43:29 +0800 CST
php 连接mssql数据库
2024-11-17 05:01:41 +0800 CST
Vue3中如何进行错误处理?
2024-11-18 05:17:47 +0800 CST
Vue 中如何处理父子组件通信?
2024-11-17 04:35:13 +0800 CST
JS 箭头函数
2024-11-17 19:09:58 +0800 CST
Go 语言实现 API 限流的最佳实践
2024-11-19 01:51:21 +0800 CST
55个常用的JavaScript代码段
2024-11-18 22:38:45 +0800 CST
LLM驱动的强大网络爬虫工具
2024-11-19 07:37:07 +0800 CST
程序员茄子在线接单