Style textShadow attribute

Definition and usage

textShadow Set or return one or more text shadow effects.

See also:

CSS Tutorial:Σκιά Τεκμηρίωσης CSS

CSS Reference Manual:text-shadow attribute

Instance

Example 1

Add shadow to text:

document.getElementById("myP").style.textShadow = "5px 5px 1px #ff0000, 10px 10px 1px #0000ff";

Try it yourself

Example 2

Return text shadow:

alert(document.getElementById("myP").style.textShadow);

Try it yourself

Syntax

Return textShadow attribute:

object.style.textShadow

Set textShadow attribute:

object.style.textShadow = "none|h-shadow v-shadow blur color|initial|inherit"

Note:The textShadow attribute adds one or more shadows to the text. The attribute is a list of shadows separated by commas, each shadow is defined by 2 or 3 length values and optional color.

Attribute value

Value Description
none Do not draw the shadow. Default.
h-shadow Required. Horizontal position of the shadow. Allows negative values.
v-shadow Required. Vertical position of the shadow. Allows negative values.
blur Optional. Blur distance.
color

Optional. Shadow color.

Please see CSS color valuesfor the complete list of possible color values.

initial Set this attribute to its default value. See initial.
inherit Inherit this attribute from its parent element. See inherit.

Technical details

Default value: none
Return value: A string that represents the list of shadow effects applied to the element text, separated by commas.
CSS version: CSS3

Browser support

Table numbers indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Υποστήριξη 10.0 Υποστήριξη Υποστήριξη Υποστήριξη