font-kerning
CSS property sets the use of the kerning information stored in a font.
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.
Kerning defines how letters are spaced. In well-kerned fonts, this feature makes character spacing more uniform and pleasant to read than it would otherwise be.
In the image below, for instance, the examples on the left do not use kerning, while the ones on the right do:
font-kerning
property is specified as one of the keyword values listed below.
auto
The browser determines whether font kerning should be used or not. For example, some browsers will disable kerning on small fonts, since applying it could harm the readability of text.
normal
Font kerning information stored in the font must be applied.
none
Font kerning information stored in the font is disabled.
| 初始值 |
auto
|
|---|---|
| 适用于 |
所有元素。它还适用于
::first-letter
and
::first-line
.
|
| 继承 | yes |
| 计算值 | 如指定 |
| 动画类型 | discrete |
auto | normal | none
<div id="kern"></div> <div id="nokern"></div> <textarea id="input">AV T. ij</textarea>
div {
font-size: 2rem;
font-family: serif;
}
#nokern {
font-kerning: none;
}
#kern {
font-kerning: normal;
}
let input = document.getElementById('input');
let kern = document.getElementById('kern');
let nokern = document.getElementById('nokern');
input.addEventListener('keyup', function() {
kern.textContent = input.value; /* Update content */
nokern.textContent = input.value;
});
kern.textContent = input.value; /* Initialize content */
nokern.textContent = input.value;
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Fonts Module Level 3
The definition of 'font-kerning' in that specification. |
候选推荐 | 初始定义。 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
font-kerning
|
Chrome
完整支持
33
|
Edge 完整支持 79 |
Firefox
完整支持
32
|
IE 不支持 No |
Opera
完整支持
20
|
Safari 完整支持 9 |
WebView Android
完整支持
4.4.3
|
Chrome Android
完整支持
33
|
Firefox Android
完整支持
32
|
Opera Android
完整支持
20
|
Safari iOS 完整支持 9 |
Samsung Internet Android
完整支持
2.0
|
完整支持
不支持
用户必须明确启用此特征。
要求使用供应商前缀或不同名称。
font-variant
,
font-variant-position
,
font-variant-east-asian
,
font-variant-caps
,
font-variant-ligatures
,
font-variant-numeric
,
font-variant-alternates
,
font-synthesis
,
letter-spacing
font
font-family
font-feature-settings
font-kerning
font-language-override
font-optical-sizing
font-size
font-size-adjust
font-smooth
font-stretch
font-style
font-synthesis
font-variant
font-variant-alternates
font-variant-caps
font-variant-east-asian
font-variant-ligatures
font-variant-numeric
font-variant-position
font-variation-settings
font-weight
line-height
line-height-step