In this article, we will learn how to Apply the Shadow Effect on Text Using CSS. The text-shadow property of CSS is used to apply the shadow effect on text.
Approach: The text-shadow property of CSS is used to apply the shadow effect on text. It takes four values vertical_shadow, horizontal_shadow, blur, and color. All the details of the properties that text-shadow properties take are below:
- vertical_shadow: It is the position of the shadow of the text vertically.
- horizontal_shadow: It is the position of the shadow of the text horizontally.
- blur: It is the value of how much blur shadow we want. It is optional.
- color: It is the color of the shadow.
Syntax:
text-shadow: vertical_shadow horizontal_shadow blur color;
Example 1: In this example, we are using the above-explained approach.
HTML
<!DOCTYPE html>
< html lang = "en" >
< head >
< title >
How to specify the width, style,
and color of the rule between columns?
</ title >
< style >
.gfg1 {
font-size: 50px;
color: rgb(3, 177, 3);
text-shadow: 2px 2px red;
}
.gfg2 {
font-size: 50px;
color: rgb(3, 177, 3);
text-shadow: 30px 30px red;
}
</ style >
</ head >
< body >
< h1 style = "margin: 10% 20%;" class = "gfg1" >GeeksforGeeks</ h1 >
< h1 style = "margin: 10% 20%;" class = "gfg2" >GeeksforGeeks</ h1 >
</ body >
</ html >
|
Output:
- Before applying text-shadow property:

- After applying text-shadow property:

Example 2: This example shows you how the blur value works in the text-shadow property.
HTML
<!DOCTYPE html>
< html lang = "en" >
< head >
< title >
How to specify the width, style,
and color of the rule between columns?
</ title >
< style >
.gfg1 {
font-size: 50px;
color: rgb(3, 177, 3);
text-shadow: 2px 2px 4px red;
}
.gfg2 {
font-size: 50px;
color: rgb(3, 177, 3);
text-shadow: 30px 30px 4px red;
}
</ style >
</ head >
< body >
< h1 style = "margin: 10% 20%;" class = "gfg1" >GeeksforGeeks</ h1 >
< h1 style = "margin: 10% 20%;" class = "gfg2" >GeeksforGeeks</ h1 >
</ body >
</ html >
|
Output:
Before applying text-shadow property with blur value:

After applying text-shadow property with blur value:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
30 May, 2023
Like Article
Save Article