XML technologies / CSS / Advanced websites with CSS / CSS property reference / text-shadow
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property text-shadow describes text shadowing. A shadow is always created as a slightly offset copy positioned behind the text. This simulates light falling on the text and casting a shadow onto the element’s background. With text-shadow, you can even create multiple shadows to simulate multiple light sources.
Inherited: no
Value
The syntax of text-shadow is as follows:
text-shadow: [color] xOffset yOffset [blurRadius][, [color] xOffset yOffset [blurRadius] ...]
A shadow is defined as a sequence of space-separated values. The last value specified has the highest priority.
[color] represents a valid CSS color specification for the shadow. If no color is defined, the element’s property color is used.
xOffset and yOffset represent the horizontal and vertical shadow offsets respectively, defined using absolute CSS measurements. Positive values move the shadow down and right; negative values move it up and left.
[blurRadius] represents the degree of blur with which the shadow is displayed, defined using absolute CSS measurements.
none suppresses the shadow.
Default value: none
Compatibility
CSS version: 2
Not supported by any current browser.
Example
The following style rule displays the content of elements of the class phantom as white text on a white background. A blurred black shadow makes the text’s outlines visible:
.phantom {
color: #fff;
background-color: #fff;
text-shadow: black 0.5em 0.5em 0.5em;
}
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg