-webkit-text-stroke

-webkit-text-stroke CSS 属性为文本字符指定了颜色。它是 -webkit-text-stroke-width (en-US)-webkit-text-stroke-color (en-US) 属性的缩写。

语法

/* 宽度和颜色属性 */
-webkit-text-stroke: 4px navy;
text-stroke: 4px navy;

/* 全局属性 */
-webkit-text-stroke: inherit;
-webkit-text-stroke: initial;
-webkit-text-stroke: unset;
text-stroke: inherit;
text-stroke: initial;
text-stroke: unset;

复合属性

该属性是以下 CSS 属性的简写:

语法

<length>

文本宽。

<color>

文本颜色。

形式定义

初始值as each of the properties of the shorthand:
适用元素all elements
是否是继承属性yes
计算值as each of the properties of the shorthand:
Animation typeas each of the properties of the shorthand:

形式语法

-webkit-text-stroke = 
<line-width> ||
<color>

<line-width> =
<length [0,∞]> |
thin |
medium |
thick

示例

添加红色文字描边

HTML

<p id="example">The stroke of this text is red.</p>

CSS

#example {
  font-size: 3em;
  margin: 0;
  -webkit-text-stroke: 2px red;
}

结果

规范

Specification
Compatibility Standard
# the-webkit-text-stroke

浏览器兼容性

BCD tables only load in the browser

参见