How to create CSS3 Box and Text Shadow Effects?

CSSWeb DevelopmentFront End Technology

To create CSS3 Box and Text Shadow effects, use the box-shadow and text-shadow property, respectively.

Following is the code to create CSS3 Box and text shadow effects −


 Live Demo

<!DOCTYPE html>
body {
   font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
h2 {
   color: rgb(28, 0, 128);
   text-shadow: red 2px 4px 2px;
div {
   color: white;
   text-align: center;
   width: 150px;
   height: 150px;
   background-color: red;
   box-shadow: rgb(89, 0, 255) 8px 2px 8px;
<h1>Shadow effect example</h1>
<h2>Text shadows</h2>
<div>BOX SHADOW</div>


The above code will produce the following output −

Published on 11-May-2020 13:13:13