Computer >> Computer tutorials >  >> Programming >> CSS

Add shadow effects to elements with CSS


Use the box-shadow property to add shadow effects to elements.

The following is an example to add shadow effects −

Example

<html>
   <head>
      <style>
         div {
            width: 300px;
            height: 100px;
            padding: 15px;
            background-color: red;
            box-shadow: 10px 10px;
         }
      </style>
   </head>
   <body>
      <div>This is a div element with a box-shadow</div>
   </body>
</html>

Output

Add shadow effects to elements with CSS