CSS3线性渐变

线性渐变用于以线性格式(如从上到下)排列两种或多种颜色。

示例

您可以尝试运行以下代码以在CSS3中实现线性渐变-

<html>
   <head>
      <style>
         #grad1 {
            height: 100px;
            background: -webkit-linear-gradient(pink,green);
            background: -o-linear-gradient(pink,green);
            background: -moz-linear-gradient(pink,green);
            background: linear-gradient(pink,green);
         }
      </style>
   </head>
   <body>
       <div id = "grad1">
      </div>
   </body>
</html>