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

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

句法

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 .

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.

描述

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.

形式定义

初始值 weight style
适用于 所有元素。它还适用于 ::first-letter and ::first-line .
继承 yes
计算值 如指定
动画类型 discrete

形式句法

none | [ weight || style ]
					

范例

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;
}
					

结果

规范

规范 状态 注释
CSS Fonts Module Level 3
The definition of 'font-synthesis' in that specification.
候选推荐 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
font-synthesis Chrome 不支持 No Edge 不支持 No Firefox 完整支持 34
完整支持 34
不支持 33 — 34 Disabled
Disabled ). To change preferences in Firefox, visit
IE 不支持 No Opera 不支持 No Safari 完整支持 9 WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 完整支持 34 Opera Android 不支持 No Safari iOS 完整支持 9 Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

用户必须明确启用此特征。

用户必须明确启用此特征。

另请参阅

元数据

  • 最后修改: