text-emphasis-color

CSS 属性 text-emphasis-color 设置强调色。这个值也可以使用简写属性 text-emphasis 来设置。

尝试一下

语法

css
/* 初始值 */
text-emphasis-color: currentcolor;

/* <color> */
text-emphasis-color: #555;
text-emphasis-color: blue;
text-emphasis-color: rgb(90 200 160 / 80%);
text-emphasis-color: transparent;

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

取值

<color>

指定用作强调色的颜色。如果未定义,该值默认为 currentcolor

形式定义

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

形式语法

text-emphasis-color = 
<color>

示例

设置自定义强调色和强调标记

CSS

css
em {
  text-emphasis-color: green;
  text-emphasis-style: "*";
}

HTML

html
<p>这是一个示例:</p>

<em>这里有强调标记!</em>

结果

规范

Specification
CSS Text Decoration Module Level 3
# text-emphasis-color-property

浏览器兼容性

BCD tables only load in the browser

参见