1. 程式人生 > >css3顏色漸變

css3顏色漸變

ble pat red -m con 顏色漸變 pos port mage

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>

  效果如下:

技術分享圖片

css3顏色漸變