-webkit-text-fill-color

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.

CSS 属性 -webkit-text-fill-color 指定了文本字符的填充颜色。若未设置此属性,则使用 color 属性的值。

语法

css
/* 颜色值 */
-webkit-text-fill-color: red;
-webkit-text-fill-color: #000000;
-webkit-text-fill-color: rgb(100 200 0);

/* 全局值 */
-webkit-text-fill-color: inherit;
-webkit-text-fill-color: initial;
-webkit-text-fill-color: revert;
-webkit-text-fill-color: revert-layer;
-webkit-text-fill-color: unset;

取值

<color>

元素的文本内容的前景填充颜色。

形式定义

初始值currentcolor
适用元素所有元素
是否是继承属性
计算值颜色计算值
动画类型a color

形式语法

-webkit-text-fill-color = 
<color>

示例

改变填充颜色

CSS

css
p {
  margin: 0;
  font-size: 3em;
  -webkit-text-fill-color: green;
}

HTML

html
<p>此文本为绿色的。</p>

结果

规范

Specification
Compatibility
# the-webkit-text-fill-color

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
-webkit-text-fill-color

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见