详解:51 指定渐变颜色的起始点和使用多个颜色 len-gradient

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        div{
            width: 400px;
            height: 400px;
            border:2px solid #abcdef;
            margin:50px;
        }
        .box1{
            background-image: linear-gradient(to right,red,yellow);
        }
        .box2{
            background-image: linear-gradient(to right,red 50%,yellow 50%);
        }
        .box3{
            background-image: linear-gradient(to right,red 100px,yellow 300px);
        }
        .box4{
            background-image: linear-gradient(red 200px,green 300px,blue 400px);
        }
        .box5{
            background-image: linear-gradient(to top,red,rgba(0,0,0,0),yellow);
        }
        .box6{
            background-image: linear-gradient(to top,red,transparent,yellow);
        }
    </style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
<div class="box5"></div>
<div class="box6"></div>
</body>
</html>
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页