动态背景颜色渐变HTML


html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>SSOSN</title>
    <link rel="shortcut icon" href="../img/cat.ico">
    <meta name="referrer" content="no-referrer">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,user-scalable=no,minimum-scale=1,maximum-scale=1">
    <meta HTTP-EQUIV="pragma" content="no-cache">
    <meta HTTP-EQUIV="Cache-Control" content="no-cache, must-revalidate">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <meta HTTP-EQUIV="expires" content="0">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
</head>
<style>
    *{
        background: #000;
        margin: 0;
        padding: 0;
        overflow:hidden;
        -moz-user-select: none;
        -khtml-user-select: none;
        user-select: none;
        -ms-overflow-style: none;
    }
    /*动态渐变背景*/
    .gradient {
        /* 设置容器尺寸 - 原理1 */
        width: 100vw;
        height: 100vh;
        /* 背景渐变色 - 原理2 */
        background: linear-gradient(-45deg, #c45839, #c2396c, #359dc4, #34bd9c);
        /* 背景尺寸 - 原理3 */
        background-size: 600% 600%;
        /* 循环动画 - 原理4 */
        animation: gradientBG 10s ease infinite;
    }
    /* 动画,控制背景 background-position */
    @keyframes gradientBG {
        0% {
            background-position: 0% 50%;
        }
        50% {
            background-position: 100% 50%;
        }
        100% {
            background-position: 0% 50%;
        }
    }
</style>
<body>
<!-- 容器 -->
<div class="gradient"></div>
</body>
</html>
相关推荐
天宇&嘘月2 小时前
web第三次作业
前端·javascript·css
小王不会写code3 小时前
axios
前端·javascript·axios
发呆的薇薇°4 小时前
vue3 配置@根路径
前端·vue.js
luckyext4 小时前
HBuilderX中,VUE生成随机数字,vue调用随机数函数
前端·javascript·vue.js·微信小程序·小程序
小小码农(找工作版)4 小时前
JavaScript 前端面试 4(作用域链、this)
前端·javascript·面试
前端没钱4 小时前
前端需要学习 Docker 吗?
前端·学习·docker
前端郭德纲4 小时前
前端自动化部署的极简方案
运维·前端·自动化
海绵宝宝_5 小时前
【HarmonyOS NEXT】获取正式应用签名证书的签名信息
android·前端·华为·harmonyos·鸿蒙·鸿蒙应用开发
码农土豆5 小时前
chrome V3插件开发,调用 chrome.action.setIcon,提示路径找不到
前端·chrome
鱼樱前端5 小时前
深入JavaScript引擎与模块加载机制:从V8原理到模块化实战
前端·javascript