text-emphasis-position - CSS: Cascading Style Sheets 编辑

The text-emphasis-position CSS property sets where emphasis marks are drawn. Like ruby text, if there isn't enough room for emphasis marks, the line height is increased.

/* Initial value */
text-emphasis-position: over right;

/* Keywords value */
text-emphasis-position: over left;
text-emphasis-position: under right;
text-emphasis-position: under left;

text-emphasis-position: left over;
text-emphasis-position: right under;
text-emphasis-position: left under;

/* Global values */
text-emphasis-position: inherit;
text-emphasis-position: initial;
text-emphasis-position: unset;

Syntax

Values

over
Draw marks over the text in horizontal writing mode.
under
Draw marks under the text in horizontal writing mode.
right
Draws marks to the right of the text in vertical writing mode.
left
Draw marks to the left of the text in vertical writing mode.

Description

The preferred position of emphasis marks depends on the language. In Japanese for example, the preferred position is over right. In Chinese, on the other hand, the preferred position is under right. The informative table below summarizes the preferred emphasis mark positions for Chinese, Mongolian and Japanese:

Preferred emphasis mark and ruby position
LanguagePreferred positionIllustration
HorizontalVertical
JapaneseoverrightEmphasis marks appear over each emphasized character in horizontal Japanese text.Emphasis marks appear on the right of each emphasized character in vertical Japanese text.
Korean
Mongolian
ChineseunderrightEmphasis marks appear below each emphasized character in horizontal Simplified Chinese text.

Note: The text-emphasis-position cannot be set, and therefore are not reset either, using the text-emphasis shorthand property.

Formal definition

Initial valueover right
Applies toall elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

[ over | under ] && [ right | left ]

Examples

Preferring ruby over emphasis marks

Some editors prefer to hide emphasis marks when they conflict with ruby. In HTML, this can be done with the following style rule:

ruby {
  text-emphasis: none;
}

Preferring emphasis marks over ruby

Some other editors prefer to hide ruby when they conflict with emphasis marks. In HTML, this can be done with the following pattern:

em {
  text-emphasis: dot; /* Set text-emphasis for <em> elements */
}

em rt {
  display: none; /* Hide ruby inside <em> elements */
}

Specifications

SpecificationStatusComment
CSS Text Decoration Module Level 3
The definition of 'text-emphasis' in that specification.
Candidate RecommendationInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:144 次

字数:7764

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文