Linear gradient with rainbow color


To create a linear gradient that looks like rainbow color, you can try to run the following code -

Example

<!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>

Updated on: 24-Nov-2023

879 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements