Add shadow to text and elements using the text-shadow and box-shadow property, respectively.
Following is the code for shadow effect in CSS −
Example
<!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: 100px; height: 100px; 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 −