--- title: '-webkit-text-stroke' slug: Web/CSS/-webkit-text-stroke tags: - CSS - CSS Property - CSS3 translation_of: Web/CSS/-webkit-text-stroke ---
-webkit-text-stroke CSS属性为文本字符指定了宽 和 颜色 . 它是{{cssxref("-webkit-text-stroke-width")}} 和{{cssxref("-webkit-text-stroke-color")}}属性的缩写.
/* 宽度和颜色属性 */ -webkit-text-stroke: 4px navy; /* 全局属性 */ -webkit-text-stroke: inherit; -webkit-text-stroke: initial; -webkit-text-stroke: unset;
<length><color>/* 设置宽度和颜色 */ -webkit-text-stroke: <length> <color>; /* 默认设置 */ -webkit-text-stroke: inherit/initial/unset;
<p id="example">The stroke of this text is red.</p>
#example {
font-size: 3em;
margin: 0;
-webkit-text-stroke: 2px red;
}
| 规范 | 状况 | 注释 |
|---|---|---|
| {{SpecName('Compat', '#the-webkit-text-stroke', '-webkit-text-stroke')}} | {{Spec2('Compat')}} | 初始标准化 |
| Safari CSS Reference '-webkit-text-stroke' in that document. |
不标准非官方文件 | 初始定义 |
兼容情况一览表
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| 基本支持 | 4 | {{CompatGeckoDesktop("48.0")}}[1] | {{CompatNo}} | 15 | 3.1 |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| 基本支持 | 4 | {{CompatGeckoMobile("48.0")}}[1] | {{CompatNo}} | 36 | 4.1 |
[1] 此功能在首选项 layout.css.prefixes.webkit 后面实现, 默认为false. 从Gecko 49 {{geckoRelease("49.0")}} 开始,默认为 true.