Add Color to the Shadow with CSS



To add a color to the shadow, use the box-shadow property and set the color, with the height and width.

You can try to run the following code to set the color to shadow:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         h2 {
            box-shadow: 10px 10px green;
            height: 70px;
            background-color: red;
         }
      </style>
   </head>
   <body>
      <h2>Heading Two</h2>
      <p>Above heading has shadow.</p>
   </body>
</html>
Updated on: 2020-06-23T15:44:27+05:30

272 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements