-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 属性的简写:
语法
值
形式定义
初始值 | as each of the properties of the shorthand:
|
---|---|
适用元素 | all elements |
是否是继承属性 | yes |
计算值 | as each of the properties of the shorthand:
|
Animation type | as each of the properties of the shorthand: |
形式语法
示例
添加红色文字描边
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