其他分享
首页 > 其他分享> > css 渐变背景色 动画

css 渐变背景色 动画

作者:互联网

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html {
            height: 100%;
        }

        body {
            margin: 0;
            padding: 0;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(125deg, #2c3e50, #27ae60, #2980b9, #e74c3c, #8e44ad);
            background-size: 500%;
            animation: bg 15s linear infinite;
        }

        .text {
            color: #fff;
            font-size: 30px;
        }

        @keyframes bg {
            0% {
                background-position: 0% 50%;
            }

            50% {
                background-position: 100% 50%;
            }

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

<body>
    <div class="text">111</div>

</body>

</html>

标签:动画,100%,50%,height,背景色,background,0%,position,css
来源: https://www.cnblogs.com/7c89/p/15820930.html