font-variant-ligatures CSS property controls which ligatures and contextual forms are used in textual content of the elements it applies to. This leads to more harmonized forms in the resulting text.

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.

句法

/* Keyword values */
font-variant-ligatures: normal;
font-variant-ligatures: none;
font-variant-ligatures: common-ligatures;           /* <common-lig-values> */
font-variant-ligatures: no-common-ligatures;        /* <common-lig-values> */
font-variant-ligatures: discretionary-ligatures;    /* <discretionary-lig-values> */
font-variant-ligatures: no-discretionary-ligatures; /* <discretionary-lig-values> */
font-variant-ligatures: historical-ligatures;       /* <historical-lig-values> */
font-variant-ligatures: no-historical-ligatures;    /* <historical-lig-values> */
font-variant-ligatures: contextual;                 /* <contextual-alt-values> */
font-variant-ligatures: no-contextual;              /* <contextual-alt-values> */
/* Global values */
font-variant-ligatures: inherit;
font-variant-ligatures: initial;
font-variant-ligatures: unset;
					

font-variant-ligatures property is specified as one of the keyword values listed below.

normal

This keyword leads to the activation of the usual ligatures and contextual forms needed for correct rendering. The ligatures and forms activated depend on the font, language and kind of script. This is the default value.

none

This keyword specifies that all ligatures and contextual forms are disabled, even common ones.

<common-lig-values>
These values control the most common ligatures, like for fi , ffi , th or similar. They correspond to the OpenType values liga and clig . Two values are possible:
  • common-ligatures activating these ligatures. Note that the keyword normal activates these ligatures.
  • no-common-ligatures deactivating these ligatures.
<discretionary-lig-values>
These values control specific ligatures, specific to the font and defined by the type designer. They correspond to the OpenType values dlig . Two values are possible:
  • discretionary-ligatures activating these ligatures.
  • no-discretionary-ligatures deactivating the ligatures. Note that the keyword normal usually deactivates these ligatures.
<historical-lig-values>
These values control the ligatures used historically, in old books, like the German tz digraph being displayed ß. They correspond to the OpenType values hlig . Two values are possible:
  • historical-ligatures activating these ligatures.
  • no-historical-ligatures deactivating the ligatures. Note that the keyword normal usually deactivates these ligatures.
<contextual-alt-values>
These values control whether letters adapt to their context—that is, whether they adapt to the surrounding letters. These values correspond to the OpenType values calt . Two values are possible:
  • contextual specifies that the contextual alternates are to be used. Note that the keyword normal usually activates these ligatures too.
  • no-contextual prevents their use.

形式定义

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

形式句法

normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]

where
<common-lig-values> = [ common-ligatures | no-common-ligatures ]
<discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]
<historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]
<contextual-alt-values> = [ contextual | no-contextual ]

范例

Setting font ligatures and contextual forms

HTML

<link href="//fonts.googleapis.com/css?family=Lora" rel="stylesheet">
<p class="normal">
  normal<br>
  if fi ff tf ft jf fj
</p>
<p class="none">
  none<br>
  if fi ff tf ft jf fj
</p>
<p class="common-ligatures">
  common-ligatures<br>
  if fi ff tf ft jf fj
</p>
<p class="no-common-ligatures">
  no-common-ligatures<br>
  if fi ff tf ft jf fj
</p>
<p class="discretionary-ligatures">
  discretionary-ligatures<br>
  if fi ff tf ft jf fj
</p>
<p class="no-discretionary-ligatures">
  no-discretionary-ligatures<br>
  if fi ff tf ft jf fj
</p>
<p class="historical-ligatures">
  historical-ligatures<br>
  if fi ff tf ft jf fj
</p>
<p class="no-historical-ligatures">
  no-historical-ligatures<br>
  if fi ff tf ft jf fj
</p>
<p class="contextual">
  contextual<br>
  if fi ff tf ft jf fj
</p>
<p class="no-contextual">
  no-contextual<br>
  if fi ff tf ft jf fj
</p>
<p class="contextual">
  contextual<br>
  if fi ff tf ft jf fj
</p>
					

CSS

p {
  font-family: Lora, serif;
}
.normal {
  font-variant-ligatures: normal;
}
.none {
  font-variant-ligatures: none;
}
.common-ligatures {
  font-variant-ligatures: common-ligatures;
}
.no-common-ligatures {
  font-variant-ligatures: no-common-ligatures;
}
.discretionary-ligatures {
  font-variant-ligatures: discretionary-ligatures;
}
.no-discretionary-ligatures {
  font-variant-ligatures: no-discretionary-ligatures;
}
.historical-ligatures {
  font-variant-ligatures: historical-ligatures;
}
.no-historical-ligatures {
  font-variant-ligatures: no-historical-ligatures;
}
.contextual {
  font-variant-ligatures: contextual;
}
.no-contextual {
  font-variant-ligatures: no-contextual;
}
.contextual {
  font-variant-ligatures: contextual;
}
					

结果

规范

规范 状态 注释
CSS Fonts Module Level 3
The definition of 'font-variant-ligatures' 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-variant-ligatures Chrome 完整支持 34 Edge 完整支持 79 Firefox 完整支持 34
完整支持 34
不支持 24 — 34 Disabled
Disabled ). To change preferences in Firefox, visit
IE 不支持 No Opera 完整支持 21 Safari 完整支持 9.1 WebView Android 完整支持 37 Chrome Android 完整支持 34 Firefox Android 完整支持 34
完整支持 34
不支持 24 — 34 Disabled
Disabled ). To change preferences in Firefox, visit
Opera Android 完整支持 21 Safari iOS 完整支持 9.3 Samsung Internet Android 完整支持 2.0

图例

完整支持

完整支持

不支持

不支持

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

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

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

元数据

  • 最后修改: