Text-shadow, for all browsers
The CSS 3 standard text shading attribute and alternative for older browsers.
The shadow effect to the characters of a text exists in Internet Explorer from the version 5.5 as a filter ActiveX. It was generalized to all browsers by becoming a property of CSS 3.
Demonstration
The standard code
The text-shadow property is followed by a definition or a list of definitions separated by a comma.
You can cancel the property with the definition: text-shadow: none.
Each definition is composed of four parameters, two of which being optional.
- Color. Optional. The default is the color of the text.
- Horizontal offset. The width of the shadow that extends to the right if the value is positive. A negative value add it on the left.
- Vertical offset. This is the height of the shadow, down if positive, up otherwise.
- Blur. Optional, defaults to 0. An integer value greater than zero makes a slightest shadow.
The code of the demo:
.tshadow { text-shadow: 1px 1px 2px black; }
To surround the characters with a halo effect:
.halo { text-shadow: 1px 1px 2px black, 0 0 1em gray, 0 0 0.2em gray; }
Example:
Demonstration
The CSS code for all browsers
<style>
.tshadow
{
text-shadow: 1px 1px 2px black;
}
.halo
{
text-shadow: 1px 1px 2px black, 0 0 1em gray, 0 0 0.2em gray;
}
</style>
For accessing these properties in JavaScript ...
object.style.textShadow="1px 2px 2px gray";