彩虹色的线性渐变

要创建看起来像彩虹色的线性渐变,您可以尝试运行以下代码\

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         #demo {
            height: 100px;
            background: linear-gradient(to right, red,orange,yellow,green,blue,indigo,violet);
         }
      </style>
   </head>
   <body>
      <h2>Linear Gradient</h2>
      <div id = "demo">Rainbow</div><br>
   </body>
</html>