W3docs

CSS text-stroke-width Property

Use the text-stroke-width CSS property to define the width of the stroke. See the Value, Practice with examples.

The -webkit-text-stroke-width property specifies the width of the text stroke.

Info

The text-stroke-width property is not standardized as a standalone property. The standard shorthand is text-stroke (CSS Text Level 4). For broad browser support, use the -webkit- vendor prefix.

Initial Value0
Applies toAll elements.
InheritedNo.
AnimatableNo
VersionCSS Text Level 4 (vendor-prefixed)
DOM Syntaxobject.style.webkitTextStrokeWidth = "1px";

Syntax

CSS text-stroke-width values

-webkit-text-stroke-width: length | initial | inherit;

Example of the text-stroke-width property:

CSS text-stroke-width code example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p, h2 {
        margin: 0;
        font-size: 4em;
        -webkit-text-stroke-color: #1c87c9;
      }
      .thin {
        -webkit-text-stroke-width: 1px;
      }
      .medium {
        -webkit-text-stroke-width: 3.5px;
      }
      .thick {
        -webkit-text-stroke-width: 1.3mm;
      }
    </style>
  </head>
  <body>
    <h2>Text-stroke-width property example</h2>
    <p class="thin">Lorem Ipsum </p>
    <p class="medium">Lorem Ipsum</p>
    <p class="thick">Lorem Ipsum</p>
  </body>
</html>

Result

CSS text-stroke-width values list

Note: Where supported, use the standard text-stroke shorthand instead of the prefixed property.

Values

ValueDescription
lengthSpecifies the thickness of the stroke.
initialMakes the property use its default value.
inheritInherits the property from its parent element.

Practice

Practice

Which statement is incorrect about CSS text-stroke-width property.