Wednesday, November 18, 2009

The text-shadow Property

This property specifies text shadows that appear with the text of an element.

The text-shadow property can be applied to any element. It is an inherited property (according to CSS 3). Its inital value is none. Its syntax is as follows:

text-shadow: color1 horizontal_offset1 vertical_offset1 blur_radius1, color2 horizontal_offset2 vertical_offset2 blur_radius2,...

The color value specifies the color of the shadow. The horizontal offset is a length value that specifies the distance to the left or right of the text that the shadow has to be rendered. A positive value renders the shadow text to the right, a negative value renders it to the left. The vertical offset is a length value that specifies the vertical distance from the text that the shadow has to be rendered. The blur radius, a length value, controls the blurriness of the shadow.

More than one shadow can be specified — each set of values are separated by a comma.

Note: text shadows have no effect on the size of the line box

Example: <p style="font-family:'Times New Roman';font-size:35px;text-shadow: green 15px 15px 0, gray -15px -15px 0">the five boxing wizards</p>

In the above example, the text has two shadows — one below and the other above. Firefox 3 and Internet Explorer 8 and below ignore the text-shadow property. Firefox 3.5, Safari 4, Chrome 3 and Opera 10 display the text shadows as shown in the picture.

Conclusion

Since the text-shadow property is ignored by Firefox 3 and Internet Explorer 8 and below, this property cannot be used.

No comments: