大网数据广告活动
Web 标准与前端开发

text-emphasis-color

· 52CE 我爱测

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

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

CSS Demo: text-emphasis-color

text-emphasis-color: currentColor;
text-emphasis-color: red;
text-emphasis-color: rgba(90, 200, 160, 0.8);
<section id="default-example">
  <p>
    I'd far rather be
    <span class="transition-all" id="example-element">happy than right</span>
    any day.
  </p>
</section>
p {
  font: 1.5em sans-serif;
}

#example-element {
  text-emphasis: filled;
}

语法

/* 初始值 */
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。

形式定义

形式语法

示例

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

CSS

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

HTML

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

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

结果

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

规范

浏览器兼容性

参见

  • <color> 数据类型
  • 其他强调标记相关属性:text-emphasis-style、text-emphasis 和 text-emphasis-position
  • 其他颜色相关属性:color、background-color、border-color、outline-color、text-emphasis-color、text-shadow、caret-color 和 column-rule-color

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。