css的linear-gradient

2020-10-28 10:31:54 浏览数 (1)

代码语言:javascript复制
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
          *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 300px;
            height: 200px;
            border: 1px solid #000;
            box-sizing: border-box;
            margin: 200px auto;
             /*默认情况下会从上至下的渐变*/
            /* background: linear-gradient(red,green);*/

             /*background: linear-gradient(to top,red,green);*/
            /* background:linear-gradient(to top right,red,green);*/
             background: linear-gradient(45deg,red, green);
         }
    </style>
</head>
<body>
<div></div>
</body>
</html>

0 人点赞