O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

text-shadow

Values:

none | [ <length>{2,4} <color>?, ] * <length>{2,4} <color>?

Initial value:

none

Applies to:

All elements

Inherited:

Yes

Computed value:

One or more sets of a color plus three absolute lengths

Description:

Defines one or more shadows to be “cast” by the text of an element. Shadows are always painted behind the element’s text, but in front of the element’s background, borders, and outline. Shadows are drawn from the first on top to the last on the bottom.

The four length values that can be declared are, in order: horizontal offset, vertical offset, blur distance, and spread distance. When positive, the offset values go down and to the right; when negative, back and to the left. Positive spread values increase the size of the shadow and negative values contract it. Blur values cannot be negative.

Examples:

h1 {text-shadow: 0.5em 0.33em 4px 2px gray;}
h2 {text-shadow: 0 −3px 0.5em blue;}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required