Widely availableSupported across all major browsers. Safe to use in production.

Overview

The text-shadow CSS property sets the position and styles of shadow on text.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
2
12
3.5
1.1
18
1
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 4 item(s)
Implementation note
  • Firefox versions before 57 have a bug whereby `transition`s will not work when transitioning from a `text-shadow` with a color specified to a `text-shadow` without a color specified (bug 726550).
  • From Firefox 4, the blur radius is capped at 300 for performance reasons.
  • Firefox theoretically supports infinite text-shadows (don't try it).
  • If the `<color>` value is unspecified, then Firefox uses the value of the element's `color` property.
Notes 2 item(s)
Implementation note
  • In Safari, any shadows that do not explicitly specify a color are transparent.
  • Safari 1.1 to 3.2 only supports one text-shadow (displays the first shadow of a comma-separated list and ignores the rest). Safari 4.0 (WebKit 528) and later support multiple text-shadows.
Notes 2 item(s)
Implementation note
  • In Safari, any shadows that do not explicitly specify a color are transparent.
  • Safari iOS 1 and 2 only support one text-shadow (displays the first shadow of a comma-separated list and ignores the rest). Safari iOS 3 (WebKit 528) and later support multiple text-shadows.

Syntax

CSS
/* Basic shadow */
.shadow {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Neon Effect */
.neon {
  text-shadow:
    0 0 7px #fff,
    0 0 10px #fff,
    0 0 21px #fff,
    0 0 42px #0fa,
    0 0 82px #0fa;
}

Live demo

basicshadow

text-shadow basicshadow demo.

PreviewFullscreen

neoneffect

text-shadow neoneffect demo.

PreviewFullscreen

enboseffect

text-shadow enboseffect demo.

PreviewFullscreen

Use cases

  • Using text-shadow

    The text-shadow CSS property sets the position and styles of shadow on text.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Make sure visual changes are conveyed appropriately to assistive technology.

Powered by web-features