---
title: font-synthesis
slug: Web/CSS/font-synthesis
tags:
  - CSS
  - 参考
  - 字体
translation_of: Web/CSS/font-synthesis
---
<div>{{CSSRef}}</div>

<p><strong><code>font-synthesis</code></strong> CSS 属性控制浏览器可以合成(synthesize)哪些缺失的字体,粗体或斜体。</p>

<div>{{EmbedInteractiveExample("pages/css/font-synthesis.html")}}</div>



<p>大多数标准西方字体包含斜体和粗体变体,但许多新颖(novelty)的字体不包括这些。用于中文、日文、韩文和其他语标文字(logographic script)的字体往往不含这些变体,同时,从默认字体中生成、合成这些变体可能会妨碍文本的易读性。在这些情况下,可能最好关闭浏览器默认的 font-synthesis 字体合成特性。</p>

<p>{{cssinfo}}</p>

<h2 id="语法">语法</h2>

<p>此属性(的值)可采用下列任意一种形式:</p>

<ul>
 <li>关键词 <code>none</code></li>
 <li>关键词 <code>weight</code> 或 <code>style</code></li>
 <li>关键词 <code>weight</code> 和 <code>style</code>。</li>
</ul>

<h3 id="属性值">属性值</h3>

<dl>
 <dt><code>none</code></dt>
 <dd>此关键词表示不合成粗体字型(typeface)或斜体字型。</dd>
 <dt><code>weight</code></dt>
 <dd>此关键词表示,如果需要的话,可以合成粗体字型。</dd>
 <dt><code>style</code></dt>
 <dd>此关键词表示,如果需要的话,可以合成斜体字型。</dd>
</dl>

<h3 id="形式化语法">形式化语法</h3>

{{csssyntax}}

<h2 id="例子">例子</h2>

<h3 id="HTML">HTML</h3>

<pre class="brush: html">&lt;em class="syn"&gt;Synthesize me! 站直。&lt;/em&gt;
&lt;br/&gt;
&lt;em class="no-syn"&gt;Don't synthesize me! 站直。&lt;/em&gt;
</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css">em {
  font-weight: bold;
}
.syn {
  font-synthesis: style weight;
}
.no-syn {
  font-synthesis: none;
}
</pre>

<h3 id="结果">结果</h3>

<p>{{ EmbedLiveSample('Examples', '', '50', '', 'Web/CSS/font-synthesis') }}</p>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
   <th scope="col">备注</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Fonts', '#propdef-font-synthesis', 'font-synthesis')}}</td>
   <td>{{Spec2('CSS3 Fonts')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_Compatibility" name="Browser_Compatibility">浏览器兼容性</h2>



<p>{{Compat("css.properties.font-synthesis")}}</p>