text-emphasis-style

Baseline 已廣泛支援

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

text-emphasis-style CSS 屬性用於設定著重號的樣式。它也可以透過 text-emphasis 簡寫屬性來設定和重置。

試一試

text-emphasis-style: none;
text-emphasis-style: triangle;
text-emphasis-style: "x";
text-emphasis-style: filled double-circle;
<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;
}

語法

css
/* Initial value */
text-emphasis-style: none; /* No emphasis marks */

/* <string> values */
text-emphasis-style: "x";
text-emphasis-style: "\25B2";
text-emphasis-style: "*";

/* Keyword values */
text-emphasis-style: filled;
text-emphasis-style: open;
text-emphasis-style: dot;
text-emphasis-style: circle;
text-emphasis-style: double-circle;
text-emphasis-style: triangle;
text-emphasis-style: filled sesame;
text-emphasis-style: open sesame;

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

none

無著重號。

filled(實心)

形狀以實心顏色填充。如果 filledopen 都沒有出現,則這是預設值。

open

形狀是空心的。

dot(點)

顯示小圓點作為標記。實心點是 '•' (U+2022),空心點是 '◦' (U+25E6)。

circle

顯示大圓圈作為標記。實心圓是 '●' (U+25CF),空心圓是 '○' (U+25CB)。

double-circle(雙圓)

顯示雙圓作為標記。實心雙圓是 '◉' (U+25C9),空心雙圓是 '◎' (U+25CE)。

triangle

顯示三角形作為標記。實心三角形是 '▲' (U+25B2),空心三角形是 '△' (U+25B3)。

sesame(芝麻)

顯示芝麻點作為標記。實心芝麻是 '﹅' (U+FE45),空心芝麻是 '﹆' (U+FE46)。

<string>

顯示給定的字串作為標記。作者不應在 <string> 中指定多個“字元”。使用者代理可能會截斷或忽略由多個字素簇組成的字串。

正式定義

初始值none
應用於所有元素
繼承性
計算值同指定值
動畫型別離散

正式語法

text-emphasis-style = 
none |
[ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] |
<string>

示例

基本示例

css
h2 {
  -webkit-text-emphasis-style: sesame;
  text-emphasis-style: sesame;
}

規範

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

瀏覽器相容性

另見