The Wayback Machine - https://web.archive.org/web/20241009101454/https://www.geeksforgeeks.org/how-to-add-shadow-to-text-using-css/
Open In App

How to add shadow to text using CSS ?

Last Updated : 07 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Adding a shadow to text using CSS involves using the text-shadow property. This property allows you to create visual effects by applying one or more shadows to text elements, enhancing their appearance with depth and emphasis. The shadows can be customized with offsets, blur, and color.

Syntax:

text-shadow: h-shadow v-shadow blur-radius color|none|initial|

Example: In this example, we demonstrate how to add shadow effects to text using CSS. The text-shadow property is applied to h1 and h2 elements, creating green and blue shadows, respectively.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>add shadow to text using CSS </title>
    <style>
        h1 {
            text-shadow: 4px 4px green;
        }

        h2 {
            text-shadow: 2px 3px blue;
        }
    </style>
</head>

<body style="text-align:center;">
    <h1>
        GeeksForGeeks
    </h1>
    <h2>
        How to apply shadow effects
        to text using CSS?
    </h2>
</body>

</html>

Output:

Supported Browsers:



Similar Reads

How to create long shadow of text without using text-shadow in HTML and CSS ?
Shadows are really a nice way to give depth and 3-D look to any text. Generally, we use text-shadow to give shadow to the text but this shadow is short and to create long shadow (shadow in which text is visible like that of reflection) we have to use before selector and skew function. Approach: The approach is to use a skew to create tilted text fi
2 min read
Difference between -webkit-box-shadow & box-shadow in CSS
In this article, we will find difference between 'webkit-box-shadow' & 'box-shadow' in CSS. Webkit-box-shadow: The webkit-box-shadow property in CSS is used to apply a box-shadow. The webkit-box-shadow is a browser-specific implementation for WebKit browsers like Google Chrome and Safari. Syntax: webkit-box-shadow: h-offset v-offset blur; Advan
1 min read
Understanding CSS Shadows: Box Shadow vs. Drop Shadow
We're going to explore CSS shadows and breaking down the key differences between "Box Shadow" and "Drop Shadow." Understanding these properties can help you create more engaging and visually appealing web designs. What is Box Shadow?Box shadow is a CSS property that allows you to add shadow effects to elements on a web page. This property allows yo
5 min read
Create a Glowing text shadow using HTML and CSS
To create a glowing text-shadow, we will use HTML to create the structure and CSS for the styling of the text. With the help of CSS, we can add shadows to text. HTML Code: In this section, we will design the basic structure of the code. C/C++ Code <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"
2 min read
How to Apply Shadow Effect on Text Using CSS ?
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
2 min read
How to add a box-shadow on one side of an element using CSS?
The box-shadow property is used to set the box shadow on one side of element. Syntax: box-shadow: h-offset v-offset blur spread color; box-shadows values: h-offset: It is required and used to set the position of the shadow horizontally. The positive value is used to set the shadow on right side of the box and a negative value is used to set the sha
2 min read
How to set inner text shadow with CSS ?
CSS is a style sheet language that describes the document's presentation written with HTML or similar markup languages. In this tutorial, we are going to learn how to set inner text shadows with CSS. Approach: Text shadow is used to design the text elements such as paragraphs, headings, etc. We first set the background color and made the text color
2 min read
CSS text-shadow Property
The CSS text-shadow property adds shadows to text for depth and emphasis. It accepts values for horizontal and vertical shadow positions, blur radius, and shadow color. The default is no shadow is none. Syntax text-shadow: h-shadow v-shadow blur-radius color | none | initial | inherit; Property values Here are the property values for the text-shado
4 min read
How to Add Shadow to Image in CSS ?
Adding shadow to an image can enhance its visual appeal and make it stand out on your webpage. In this article, we will explore various approaches to add shadow to an image using CSS. Table of Content Add Shadow on Image using box-shadow PropertyAdd Shadow on Image on HoverAdd Shadow on Image using filter Property with drop-shadowAdd Shadow on Imag
2 min read
How to Add Shadow to Button in CSS ?
This article will show you how to add shadow to a button using CSS. Button shadow can enhance its visual appeal and make it stand out on your webpage. This article will cover various approaches to adding shadow to a button using CSS. Table of Content Add Shadow on button using box-shadow PropertyAdd Shadow to Button on HoverAdd Shadow to Button usi
3 min read
How to Add Shadow Effect on Hover to DIV Boxes in CSS ?
Adding a shadow effect on hover to DIV boxes is a popular technique to enhance the visual appeal and interactivity of a website. In this article, we will explore two different methods to achieve this effect using CSS. Table of Content Using box-shadow PropertyUsing filter Property with drop-shadowAdd Shadow Effect on Hover to DIV Box using box-shad
2 min read
How to Add Shadow in CSS?
Shadows in CSS can be used to create depth and visual interest by adding the effect that simulates the shadow of an element. It can be applied to both the text and block elements to enhance the design of the web pages. CSS can provide several properties to achieve different shadow effects, including box-shadow and text shadow. Below are the two app
5 min read
How To Add Custom Box Shadow In Tailwind CSS?
Tailwind CSS is a utility-focused CSS framework. Offers a wide range of design utilities. It does include predefined shading, however, for unique design needs, you might want a custom box shadow that goes beyond the default. in this article, you will learn how to extend Tailwind's default shadow and how to create a custom box shadow utility in your
3 min read
How to add shadow to a canvas circle using Fabric.js ?
In this article, we are going to see how to add shadow to a canvas circle using FabricJS. The canvas means the circle is movable and can be stretched according to requirement. Further, the circle can be customized when it comes to initial stroke color, fill color, stroke width, or radius. Approach: To make it possible, we are going to use a JavaScr
2 min read
How to Add a Border or Shadow to Elements using Bootstrap 5 Classes ?
To add a border in Bootstrap 5, we can use classes like 'border' for a full border or border-top, border-end, border-bottom, border-start for specific sides. For shadows, apply classes like 'shadow' for a default shadow, shadow-sm for a small shadow, or shadow-lg for a large shadow. Table of Content Shadow classesBorder ClassesShadow classesBootstr
2 min read
Fabric.js | Text shadow Property
In this article, we are going to see how to add shadow to the text canvas using FabricJS. The canvas means text written is movable, rotatable, resizable, and can be stretched. But in this article, we will add shadow to it. Further, the text itself cannot be edited like a textbox. Approach: To make it possible, we are going to use a JavaScript libra
2 min read
How to add Box-Shadow to The Clip-Path Object ?
As we all know that we can apply the shadow using the Box-Shadow attribute of CSS, but it is not valid if we apply it on the clipped Object using Clip-Path() function of CSS. Approach: We are going to create two divs, one for the main and the other for our clipped shape.Then we are going to use the drop-shadow() function to apply shadow effects. HT
2 min read
How to Add a Shadow to an Element ?
Adding shadow to the elements enhances the appearance of the UI elements. Shadow is a property that makes the element look in the 3D visuals. Below are some of the approaches to add shadow to an element: Table of Content Using drop-shadow() filter propertyUsing box-shadow PropertyUsing drop-shadow() filter propertyIn this approach, we are using the
2 min read
How to Add a Shadow to a Button ?
Adding a shadow to the button significantly enhances the visual appeal of the elements, improving the overall look and feel of the application. We can add a Shadow to a Button using different approaches including, the box-shadow property, CSS variables, filter property, and pseudo-class. We can use these approaches to add a shadow to the button: Ta
5 min read
How set the shadow color of div using CSS ?
In this article, we will see how to set the shadow color of the div using CSS. Like humans have their shadows we can use CSS to make any color of shadow to the div element. Box shadow property: This property is used to create one or more than one shadow of an element. Syntax: box-shadow: h-offset v-offset blur spread color |none|inset|initial| inhe
2 min read
Drop shadow for PNG image using CSS
There is a basic way to add shadow effect on images but that effect will behave like the image is square, so there is another way to do the shadow which is basically applied on PNG images. The normal shadow effect will always put a square image shadow for the image which can be squared or cannot be squared but the shadow will be always square. filt
2 min read
How to apply no shadow in an element using CSS ?
In this article, we are going to learn How to apply no shadow in an element using CSS, To remove the box shadow from an element in CSS, you can use the box-shadow property with a value of none, like this: box-shadow: none, This will effectively remove any existing shadow or prevent a shadow from being applied to the element. In this article, we wil
1 min read
How to create a gradient shadow using CSS ?
In this article, we will see how to create a gradient shadow using CSS, along with knowing the various CSS properties applied to get the gradient shadow effects. The gradient shadow means adding the gradient with shadow effect to the element. The gradient can be linear, radial, or cylindrical. Generally, the gradient shadow can be implemented on th
3 min read
How to create a drop shadow effect using CSS ?
In this article, we are going to learn how to create a drop shadow effect using CSS. drop-shadow() is an inbuilt function used to create a blurred shadow in a given offset and color. A drop shadow effect adds depth and visual interest to elements on a web page by creating a shadow behind them. This effect can be achieved using various CSS propertie
3 min read
How to set the inset shadow using CSS ?
In CSS, an inset shadow is applied using the box-shadow property with the inset keyword. This creates an inner shadow effect, making the shadow appear inside the element's boundaries rather than outside, giving it a recessed or sunken appearance. Note: By default, the shadow generates outside the box but by the use of inset we can create the shadow
2 min read
How to style icon color, size, and shadow by using CSS ?
Icons are a great way to enhance the user interface of a website. The <i> tag and <span> tag are commonly used to add icons to web pages. When using Font Awesome, adding icons is simple and requires no downloads or installations—just include the Font Awesome CDN link in your <head> section. Icons can then be styled easily with CSS
2 min read
Primer CSS Extra large Box Shadow
Primer CSS is a free open-source CSS framework that is built upon systems that create the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, and BEM architecture
2 min read
How to apply box-shadow to display elements like single element to user in CSS ?
In CSS, the box-shadow property allows you to add a shadow effect to an element. However, when it comes to applying box shadow to a combination of elements such as a <span> and <input>, it can be a bit tricky to get the desired effect. In this article, we will discuss how to apply box-shadow to a <span> <input> combination s
2 min read
Materialize CSS Pulse and Shadow
Pulse: Used for get attention towards buttons with this subtle but captivating effect. Just required to add pulse class to buttons. Note: This is used only for floating button since it will not work with other components. <a class="btn-floating pulse"><i class="material-icons">battery_alert</i></a> <a class="btn-floating
2 min read
Onsen UI CSS Component No Shadow Toolbar
Onsen UI CSS is used to create beautiful HTML components. It is one of the most efficient ways to create HTML5 hybrid components that are compatible with both mobile and desktop. In this article, we will see the Onsen UI CSS Component No Shadow Toolbar. The toolbar is a horizontal bar with some toolbar items and icons. Onsen UI CSS Component No Sha
2 min read