You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > webkitTextStroke

webkitTextStroke style property

Browser support:
Sets or retrieves the color and width of the text outline.

Syntax:

object.webkitTextStroke;
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: -webkit-text-stroke

Possible values:

The type of this property is string.
 One of the following values: 
 Any of the following values (use the space character to separate them, each value can be used only once): 
<-webkit-text-stroke-color>
<-webkit-text-stroke-width>
inherit

Description of values:

-webkit-text-stroke-color
Sets or retrieves the color of text's outline.
-webkit-text-stroke-width
Sets or retrieves the width of text's outline.
inherit
Takes the value of this property from the computed style of the parent element.
Default: black.

Example HTML code 1:

This example illustrates the use of the -webkit-text-stroke property:
<head>
    <style>
        #myDiv { 
            -webkit-text-fill-color: red;
            -webkit-text-stroke: 1px red;
        }
    </style>
</head>
<body>
    <div id="myDiv">
        Some stroked text
    </div>
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the webkitTextStroke property in JavaScript:
<head>
    <style>
        #myDiv { 
            -webkit-text-fill-color: red;
            -webkit-text-stroke: 1px red;
        }
    </style>
    <script type="text/javascript">
        function ChangeStroke () {
            var div = document.getElementById ("myDiv");

            if ('webkitTextStroke' in div.style) {
                div.style.webkitTextStroke = "2px green";
            } else {
                alert ("Your browser doesn't support this example!");
            }
        }
    </script>
</head>
<body>
    <div id="myDiv">
        Some stroked text
    </div>
    <button onclick="ChangeStroke ();">Change stroke</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content