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 属性

浏览器兼容性

另见