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 −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
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;
}
</style>
</head>
<body>
<h1>Shadow effect example</h1>
<h2>Text shadows</h2>
<div>BOX SHADOW</div>
</body>
</html>

Output

The above code will produce the following output −

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