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

2020-10-28 16:00:32 浏览数 (1)

代码语言:javascript复制
<!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>

0 人点赞