In this example you will learn, how to apply shadow effect on text using CSS. You can simply use the CSS text-shadow property to apply the shadow effect (like Photoshop drop-shadow style) on text elements. You can also apply more than one shadow (applied front-to-back) through providing a comma-separated list of shadows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CSS Text Shadow Effect</title> <style> p{ font: 26px sans-serif; } p.shadow{ text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6); } p.shadow-multiple{ text-shadow: 2px 2px 3px yellow, 3px 3px 5px red; } p.shadow-outline{ color: #fff; text-shadow: -1px 0 #000, 0 1px #000, 1px 0 #000, 0 -1px #000; } </style> </head> <body> <p class="shadow">This is a simple example of text shadow effect.</p> <p class="shadow-multiple">This is a simple example of multiple text shadow effect.</p> <p class="shadow-outline">This is another example of multiple text shadow effect.</p> </body> </html> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.