text-emphasis-color

Baseline 已廣泛支援

此特性已經十分成熟,可在許多裝置和瀏覽器版本上使用。自 2022 年 3 月起,它已在各瀏覽器中可用。

text-emphasis-color CSS 屬性設定著重號的顏色。此值也可以使用 text-emphasis 簡寫屬性來設定。

試一試

text-emphasis-color: currentColor;
text-emphasis-color: red;
text-emphasis-color: rgb(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;
}

語法

css
/* Initial value */
text-emphasis-color: currentColor;

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

/* Global values */
text-emphasis-color: inherit;
text-emphasis-color: initial;
text-emphasis-color: revert;
text-emphasis-color: revert-layer;
text-emphasis-color: unset;

<color>

定義著重號的顏色。如果未指定顏色,則預設為 currentColor

正式定義

初始值currentcolor
應用於所有元素
繼承性
計算值computed color
動畫型別一種顏色

正式語法

text-emphasis-color = 
<color>

示例

帶有顏色和自定義字元的著重號

CSS

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

HTML

html
<p>Here's an example:</p>

<em>This has emphasis marks!</em>

結果

規範

規範
CSS 文字裝飾模組級別 3
# text-emphasis-color 屬性

瀏覽器相容性

另見