css的linear-gradient注意点

时间:2022-07-28
本文章向大家介绍css的linear-gradient注意点,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>127-线性渐变</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .main{
            width: 400px;
            height: 200px;
            border: 1px solid #000;
            box-sizing: border-box;
            margin: 200px auto;
            /*
            注意点:
            至少需要传递2个颜色, 至多没有上限
            */
            
            */
            background: linear-gradient(to right, red 100px, green 100px, blue 100px);
        }
        .one, .two, .three{
            width: 100px;
            height: 100%;
            border: 1px solid #000;
            box-sizing: border-box;
            float: left;
        }
    </style>
</head>
<body>
<div class="main">
    <div class="one"></div>
    <div class="two"></div>
    <div class="three"></div>
</div>
</body>
</html>