Movatterモバイル変換


[0]ホーム

URL:


  1. 面向开发者的 Web 技术
  2. CSS:层叠样式表
  3. CSS 参考
  4. 属性
  5. text-emphasis-color

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in EnglishAlways switch to English

text-emphasis-color

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2022年3月.

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

尝试一下

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

语法

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
适用元素所有元素
是否是继承属性
计算值颜色计算值
动画类型acolor

形式语法

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

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp