font-synthesis - CSS: Cascading Style Sheets 编辑

The font-synthesis CSS property controls which missing typefaces, bold or italic, may be synthesized by the browser.

Syntax

This property can take any one of the following forms:

  • The keyword value none.
  • Either of the keyword values weight and style.
  • Both the keyword values weight and style.

Values

none
Indicates that neither bold nor italic typeface may be synthesized.
weight
Indicates that a bold typeface may be synthesized if needed.
style
Indicates that an italic typeface may be synthesized if needed.

Description

Most standard Western fonts include italic and bold variants, but many novelty fonts do not. Fonts used for Chinese, Japanese, Korean and other logographic scripts tend not to include these variants, and synthesizing them may impede the legibility of the text. In these cases, it may be desirable to switch off the browser's default font-synthesis.

Formal definition

Initial valueweight style
Applies toall elements. It also applies to ::first-letter and ::first-line.
Inheritedyes
Computed valueas specified
Animation typediscrete

Formal syntax

none | [ weight || style ]

Examples

Disabling font synthesis

HTML

<em class="syn">Synthesize me! 站直。</em>
<br/>
<em class="no-syn">Don't synthesize me! 站直。</em>

CSS

em {
  font-weight: bold;
}
.syn {
  font-synthesis: style weight;
}
.no-syn {
  font-synthesis: none;
}

Result

Specifications

SpecificationStatusComment
CSS Fonts Module Level 3
The definition of 'font-synthesis' in that specification.
RecommendationInitial definition

Browser compatibility

BCD tables only load in the browser

See also

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

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

发布评论

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

词条统计

浏览:74 次

字数:5548

最后编辑:7年前

编辑次数:0 次

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