Skip to content
Related Articles

Related Articles

How to Apply Shadow Effect on Text Using CSS ?
  • Last Updated : 07 Apr, 2021

In this article, we will learn how to Apply 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:

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 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:

    My Personal Notes arrow_drop_up
  • Recommended Articles
    Page :