css3颜色渐变

css代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #div1 {
            width: 200px;
            height: 200px;
            border: 1px solid #333;
             background: -webkit-linear-gradient(top,red,yellow); /* chrome */
             background: -ms-linear-gradient(top,red,yellow); /* IE10及以上 */
             background: -moz-linear-gradient(top,red,yellow); /* 火狐 */
             background: linear-gradient(top,red,yellow); /* 兼容 */
        }
    </style>
</head>
<body>
    <div id="div1"></div>
</body>
</html>

  效果如下:

 

posted @ 2017-12-21 23:14  pding  阅读(330)  评论(0编辑  收藏  举报