textShadow Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:textShadow

Description

The textShadow property sets or gets one ore more shadow effects for a text.

Property Values

ValueDescription
none No shadow is drawn. Default
h-shadow Required. The position of the horizontal shadow. Negative values are allowed
v-shadow Required. The position of the vertical shadow. Negative values are allowed
blur Optional. The blur distance
colorOptional. The color of the shadow.
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: none?
Return Value: A String, representing a comma-separated list of shadow effects applied to the text of the element
CSS VersionCSS3

Add shadow to a text:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" style="text-shadow:2px 2px green;">This is an example paragraph.</p>

<button type="button" onclick="myFunction()">Test</button>

<script>
function myFunction() {//from  www. j  av  a 2  s.com
    document.getElementById("myP").style.textShadow = '2px 2px red';
}
</script>

</body>
</html>

Related Tutorials