CSS text-shadow Property
Adds shadow effects to text with offset, blur, and color
Syntax
text-shadow: none | <offset-x> <offset-y> <blur-radius>? <color>?;Values
| Value | Description |
|---|---|
| none | No shadow (default) |
| 1px 1px 2px rgba(0,0,0,0.3) | Subtle drop shadow |
| 0 0 10px #fff | Glow effect |
| 2px 2px 0 #000, -2px -2px 0 #000 | Outline effect |
Example
.glow-text {
text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}Understanding CSS text-shadow
The CSS text-shadow property adds shadow effects to text with offset, blur, and color. As part of the Typography module in CSS, it is one of the most commonly used properties for controlling the visual presentation of web pages.
You can set text-shadow to values such as none, 1px 1px 2px rgba(0,0,0,0.3), 0 0 10px #fff, 2px 2px 0 #000, -2px -2px 0 #000, among others. Each value changes how the browser renders the affected element, giving you fine-grained control over your page layout and design. Choosing the right value depends on the specific design requirements of your project.
Common use cases for the text-shadow property include responsive web design, component-based layouts, and creating visually consistent interfaces across devices. It works closely with related properties like box-shadow, color, filter to achieve complex styling effects. Understanding how these properties interact helps you write cleaner, more maintainable stylesheets.
Browser support for text-shadow is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. For older browsers, consider using fallback values or progressive enhancement strategies. The property can also be set dynamically via JavaScript using element.style.textShadow or the CSS custom properties (variables) approach for theming.
Related Properties
Explore More CSS Properties
Browse our complete reference of 251 CSS properties with syntax, examples, and tips.