Home 〉 CSS Tutorials 〉 CSS Text Shadow Property Explained with Examples - Learn How to Use 'text-shadow' in CSS
CSS Text Shadow Property Explained with Examples - Learn How to Use 'text-shadow' in CSS !
Want to add depth to your text elements? The CSS `text-shadow` property lets you apply shadow effects to text, enhancing readability and design. This tutorial demonstrates how to set horizontal and vertical shadows, blur radius, and color. Learn to create subtle or dramatic text effects to suit your design needs. Read the complete tutorial on CSS Text Shadow Property
The 'text-shadow' property in CSS lets you apply shadow effects to text. It's a great way to make headings or titles stand out and enhance readability or design aesthetics.
Syntax ✍
selector {
text-shadow: horizontal-offset vertical-offset blur-radius color;
}
<!DOCTYPE html>
<html>
<body>
<h2 style="text-shadow: 2px 2px 5px gray;">This is shadowed text</h2>
</body>
</html>
output 📌
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
<!DOCTYPE html>
<html>
<body>
<p style="text-shadow: 1px 1px 3px red;">Red glowing text shadow</p>
</body>
</html>
output 📌
Red glowing text shadow
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
This makes the text glow slightly with a red shadow, creating a subtle highlight.
You can apply multiple shadows for more effects:
<!DOCTYPE html>
<html>
<body>
<h3 style="text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;">Outlined Text</h3>
</body>
</html>
output 📌
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Two shadows are added to give an outline-like appearance.
<!DOCTYPE html>
<html>
<body>
<h1 style="color: white; text-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 20px #0ff;">
Glowing Neon Text
</h1>
</body>
</html>
output 📌
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
This creates a neon glow using layered shadows with the same color but increasing blur.
The 'text-shadow' property is simple but powerful. Whether you want to add a soft blur or bold glow, it helps you create more attractive headings, buttons, and more.
Yes, separate them with commas.
Yes, it's widely supported in all modern browsers.
Use it for headings, highlighting text, or adding glow effects.
Yes, you can use CSS transitions or keyframes to animate 'text-shadow'.
No, it's just a visual effect and doesn't take up space.