Definition and Usage
The -webkit-text-stroke-width property
specifies the width (thickness) of the text stroke.
Explore its syntax, usage, and key considerations with practical examples.
- In addition to this property, which specifies the width of the text stroke, there is the
-webkit-text-stroke-colorproperty that specifies the color of the stroke. - There is also the shorthand property
-webkit-text-strokethat specifies both properties at once.
Basic Example
TEXT STROKE
Formal syntax
selector {
-webkit-text-stroke-width: <line-width>
}
Syntax
/* Keyword values */
-webkit-text-stroke-width: thin;
-webkit-text-stroke-width: medium;
-webkit-text-stroke-width: thick;
/* Length values */
-webkit-text-stroke-width: 4px;
-webkit-text-stroke-width: 0.15em;
-webkit-text-stroke-width: 3mm;
-webkit-text-stroke-width: 6pt;
/* Percentage (%) units are not supported */
-webkit-text-stroke-width: 5%; /* ❌ Invalid */
/* Global values */
-webkit-text-stroke-width: inherit;
-webkit-text-stroke-width: initial;
-webkit-text-stroke-width: revert;
-webkit-text-stroke-width: revert-layer;
-webkit-text-stroke-width: unset;
Values
<line-width> |
Value for the width (thickness) of the stroke |
|---|
Formal definition
| Initial value | 0 |
|---|---|
| Applies to | all elements |
| Inherited | yes |
| Animation | no |
Things to Keep in Mind
- Animation only applies to the
-webkit-text-stroke-colorvalue. It does not apply to the-webkit-text-stroke-widthvalue. - The percentage (%) unit cannot be used for the
-webkit-text-stroke-widthvalue.
Examples
<style>
.text {
font-size: 47px;
font-weight: 900;
color: white;
-webkit-text-stroke-color: red;
-webkit-text-stroke-width: 1px;
}
</style>
<p class="text">TEXT STROKE</p>
TEXT STROKE
Browser compatibility
| Property |
Desktop Chrome
|
DesktopDesktop Edge
|
Desktop Firefox
|
Safari
|
|---|---|---|---|---|
-webkit-text-stroke-width
|
1 | 15 | 49 | 3 |
Specifications
| Specification | |
|---|---|
-webkit-text-stroke-width
|
Compatibility Standard #the-webkit-text-stroke-width |
References
See also
- CSS -webkit-text-stroke Property – Styling the Stroke of Text
- CSS -webkit-text-stroke-color Property – Specifies the Stroke Color of Text
- CSS text-shadow Property – Applying Shadow Effects to Text
- CSS text-decoration-thickness Property – Specifies the Thickness of Decorations
- CSS text-emphasis Property – Shorthand for Emphasis Marks