CSS font-kerning Property
The font-kerning property controls whether the browser applies font-defined spacing adjustments between certain pairs of characters.
Kerning improves the visual spacing of text by adjusting the distance between particular glyph pairs, such as AV, To, and Wa. These adjustments depend on the kerning information provided by the selected font and can make headings, logos, and other text appear more evenly spaced.
font-kerning Syntax
The font-kerning property accepts three values: auto, normal, and none.
Basic Syntax
selector {
font-kerning: normal;
}
Automatic Kerning
selector {
font-kerning: auto;
}
Enable Kerning
selector {
font-kerning: normal;
}
Disable Kerning
selector {
font-kerning: none;
}
CSS-Wide Keywords
.example {
font-kerning: inherit;
}
.example {
font-kerning: initial;
}
.example {
font-kerning: unset;
}
.example {
font-kerning: revert;
}
.example {
font-kerning: revert-layer;
}
The property does not accept lengths, percentages, or numeric spacing values. To adjust general spacing between characters, use letter-spacing.
Property Values
Each value determines how the browser handles kerning information available in the selected font.
| Value | Description |
|---|---|
auto |
Allows the browser to decide whether kerning should be applied. |
normal |
Requests the use of kerning information provided by the font. |
none |
Disables font kerning adjustments. |
CSS-Wide Values
| Value | Description |
|---|---|
inherit |
Uses the computed value of the parent element. |
initial |
Restores the initial value, auto. |
unset |
Uses the inherited value because the property is inherited. |
revert |
Reverts the property according to CSS cascade origins. |
revert-layer |
Reverts the property according to CSS cascade layers. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | auto |
| Inherited | Yes |
| Applies to | All elements and text |
| Computed value | As specified |
| Animation type | Discrete |
| Percentages | Not applicable |
Kerning adjustments are determined by the font's glyph positioning information rather than by a fixed CSS spacing amount.
How It Works
Fonts normally provide an advance width for each glyph. When characters appear next to one another, their shapes can create uneven-looking spaces even when their advance widths are appropriate.
Kerning allows the font to adjust the positioning of particular glyph pairs to improve their visual relationship.
Step 1: Select a Font
h1 {
font-family: Georgia, serif;
}
Step 2: Enable Kerning
h1 {
font-family: Georgia, serif;
font-kerning: normal;
}
Step 3: Apply Font-Defined Adjustments
If the selected font provides kerning information, the browser can use it to adjust the spacing of appropriate glyph pairs.
Step 4: Render the Text
The resulting text may appear more evenly spaced. Kerning can also affect the total width of a line and, in some cases, where text wraps.
Important Consideration
Kerning does not apply the same adjustment between every character. It uses information associated with specific glyph combinations in the font.
The auto Value
The auto value allows the browser to determine whether kerning should be applied.
Example
p {
font-kerning: auto;
}
Default Behavior
The auto value is the initial value of font-kerning. Browser behavior may depend on the font, text size, rendering environment, and implementation.
Automatic Kerning in Body Text
body {
font-family: Georgia, serif;
font-kerning: auto;
}
Important Consideration
Using auto does not guarantee that kerning will always be enabled. Use normal when you want to explicitly request font kerning.
The normal Value
The normal value requests the use of kerning information available in the selected font.
Enable Kerning for Headings
h1,
h2,
h3 {
font-kerning: normal;
}
Enable Kerning for a Display Title
.display-title {
font-family: Georgia, serif;
font-size: 48px;
font-kerning: normal;
}
Enable Kerning Throughout a Page
body {
font-kerning: normal;
}
Because the property is inherited, descendants generally receive the same value unless another rule overrides it.
Important Consideration
The normal value requests kerning but cannot create kerning information that is missing from the font.
The none Value
The none value disables font kerning adjustments.
Disable Kerning
.no-kerning {
font-kerning: none;
}
Disable Kerning in a Heading
.heading {
font-family: Georgia, serif;
font-size: 40px;
font-kerning: none;
}
Compare Kerning Settings
.kerning-enabled {
font-kerning: normal;
}
.kerning-disabled {
font-kerning: none;
}
When Disabling Kerning May Be Useful
Disabling kerning can be useful when comparing font rendering, testing typography, or reproducing a particular text appearance that does not use kerning adjustments.
Important Consideration
Disabling kerning does not remove all spacing between characters. Glyph advance widths and other spacing rules still apply.
Common Kerning Pairs
Some character combinations can create noticeable visual gaps because of the shapes of adjacent letters.
Examples of Kerning Pairs
| Pair | Why Kerning May Help |
|---|---|
AV |
The diagonal strokes may allow the characters to sit closer together. |
AW |
Diagonal character shapes may produce an uneven visual gap. |
To |
The horizontal top of T may extend over part of the lowercase o. |
Ta |
The shape of T can create extra visual space before a. |
Wa |
The diagonal strokes of W may affect the apparent spacing. |
Yo |
The angled upper character can create an irregular gap. |
Example Text
<p class="kerning-text">AVATAR To Wa Yo</p>
.kerning-text {
font-family: Georgia, serif;
font-size: 40px;
font-kerning: normal;
}
Important Consideration
Not every font contains kerning adjustments for these pairs. The size and direction of an adjustment are determined by the font design.
Kerning and Font Size
Kerning can be especially noticeable in large headings and display text, where uneven character spacing is easier to see.
Large Heading
h1 {
font-family: Georgia, serif;
font-size: 56px;
font-kerning: normal;
}
Smaller Body Text
p {
font-family: Georgia, serif;
font-size: 16px;
font-kerning: normal;
}
Automatic Kerning at Different Sizes
.small-text {
font-size: 12px;
font-kerning: auto;
}
.large-text {
font-size: 48px;
font-kerning: auto;
}
With auto, the browser may make different kerning decisions depending on the text size and rendering environment.
Important Consideration
Kerning should not be confused with optical sizing. The font-optical-sizing property controls the use of size-specific designs in compatible variable fonts, while font-kerning controls kerning adjustments.
Kerning vs. Letter Spacing
The font-kerning and letter-spacing properties both affect text spacing, but they serve different purposes.
Kerning
.kerning-example {
font-kerning: normal;
}
Kerning uses font-defined adjustments for particular glyph combinations.
Letter Spacing
.spacing-example {
letter-spacing: 2px;
}
Letter spacing adds or removes spacing between typographic characters according to the specified value.
Using Both Properties
.heading {
font-family: Georgia, serif;
font-kerning: normal;
letter-spacing: 0.02em;
}
Comparison
| Property | Purpose |
|---|---|
font-kerning |
Controls font-defined spacing adjustments between glyph pairs. |
letter-spacing |
Controls additional spacing between typographic characters. |
Important Consideration
Excessive letter spacing can reduce readability and change how kerning is perceived. Test both properties together when designing headings or navigation text.
Kerning and OpenType Features
OpenType fonts can store kerning information in their font tables. The OpenType "kern" feature is one mechanism used for glyph positioning adjustments.
Using font-kerning
.example {
font-kerning: normal;
}
Using font-feature-settings
.example {
font-feature-settings: "kern" 1;
}
Disabling the OpenType Feature
.example {
font-feature-settings: "kern" 0;
}
Which Property Should You Use?
For ordinary kerning control, use font-kerning. It expresses the intended behavior directly and allows the browser to work with the font's available kerning mechanisms.
The font-feature-settings property is intended for lower-level control of specific OpenType features.
Important Consideration
Explicit low-level feature settings can override corresponding higher-level font settings. Avoid conflicting declarations unless the interaction is intentional.
Font Support and Fallback
The visual effect of font-kerning depends on the selected font and its available kerning information.
Font with Kerning Information
.example {
font-family: Georgia, serif;
font-kerning: normal;
}
When the selected font contains applicable kerning data, the browser can use it.
Font Without Kerning Information
.example {
font-family: "Example Font", sans-serif;
font-kerning: normal;
}
If the selected font lacks kerning information for the displayed characters, the property may produce no visible difference.
Fallback Fonts
.example {
font-family: "Preferred Font", Arial, sans-serif;
font-kerning: normal;
}
If the preferred font is unavailable, the browser can use a fallback font. Kerning behavior then depends on the selected fallback font.
Custom Web Fonts
Fonts loaded using @font-face can include kerning information. Make sure the font files preserve the positioning data needed for the intended typography.
Important Consideration
Kerning information is not guaranteed for every glyph pair. Two fonts can display the same text with different kerning adjustments.
Inheritance
The font-kerning property is inherited, allowing descendants to use the same kerning setting unless another rule overrides it.
Enable Kerning for a Container
.article {
font-kerning: normal;
}
Text elements inside the container inherit the kerning setting unless another declaration applies.
Override a Child Element
.article {
font-kerning: normal;
}
.article .special-heading {
font-kerning: none;
}
Explicit Inheritance
.child {
font-kerning: inherit;
}
Reset to the Initial Value
.child {
font-kerning: initial;
}
The initial value is auto.
Important Consideration
Inheritance controls the requested kerning behavior, but actual adjustments still depend on the font used to render each text segment.
font-kerning Example
This example compares text with kerning enabled and disabled. Large text and character combinations such as AV, To, and Wa help make spacing differences easier to observe.
HTML Example
<div class="kerning-demo">
<p class="demo-label">Kerning enabled</p>
<p class="demo-normal">AVATAR To Wa</p>
<p class="demo-label">Kerning disabled</p>
<p class="demo-none">AVATAR To Wa</p>
<p class="demo-label">Automatic kerning</p>
<p class="demo-auto">AVATAR To Wa</p>
</div>
CSS Example
.kerning-demo {
font-family: Georgia, serif;
}
.kerning-demo p {
margin: 0 0 12px;
}
.demo-label {
font: 600 13px/1.4 Arial, sans-serif;
}
.demo-normal {
font-size: 42px;
font-kerning: normal;
}
.demo-none {
font-size: 42px;
font-kerning: none;
}
.demo-auto {
font-size: 42px;
font-kerning: auto;
}
Kerning enabled
AVATAR To Wa
Kerning disabled
AVATAR To Wa
Automatic kerning
AVATAR To Wa
The normal example requests font-defined kerning adjustments, while none disables them. The auto example leaves the decision to the browser.
The difference may be subtle or absent depending on the font, browser, and rendering environment.
Common Mistakes
Understanding the difference between kerning and general character spacing helps avoid unexpected typography results.
Using a Length Value
.example {
font-kerning: 2px;
}
This declaration is invalid. The property accepts auto, normal, or none, not a spacing length.
Using a Boolean Value
.example {
font-kerning: true;
}
The property does not accept true or false.
Confusing Kerning with Letter Spacing
.example {
letter-spacing: 3px;
}
Letter spacing changes general spacing between characters. It does not directly enable font-defined kerning adjustments.
Expecting Every Character Pair to Change
Kerning affects only combinations for which the selected font provides applicable positioning adjustments.
Expecting Identical Results Across Fonts
Different fonts contain different kerning information. The same CSS declaration can produce different visual results.
Assuming auto Always Enables Kerning
The auto value allows the browser to decide whether to apply kerning. Use normal to request it explicitly.
Ignoring Font Fallback
If a preferred font is unavailable, the browser may select another font with different kerning characteristics.
Using Conflicting Feature Settings
Low-level OpenType settings can affect the same kerning behavior. Avoid unnecessary conflicts between font-kerning and font-feature-settings.
Important Considerations
Keep the following points in mind when using the font-kerning property:
- Purpose: Controls font-defined spacing adjustments between certain glyph pairs.
- Initial value:
auto. - Inheritance: The property is inherited.
- Applies to: All elements and text.
- Accepted values:
auto,normal, andnone. - auto: Allows the browser to determine whether kerning is applied.
- normal: Requests font-defined kerning adjustments.
- none: Disables kerning adjustments.
- Font dependency: The selected font must provide suitable kerning information.
- Character pairs: Adjustments apply to specific glyph combinations rather than every character pair.
- Large text: Kerning differences are often easier to notice in headings and display text.
- Body text: Kerning can also improve the appearance of smaller text when supported.
- Letter spacing: Use
letter-spacingfor additional general character spacing. - OpenType: The
"kern"feature is one mechanism for kerning in OpenType fonts. - Low-level control:
font-feature-settingscan control specific OpenType features. - Font fallback: Different fallback fonts can produce different kerning results.
- Text width: Kerning may affect the width and wrapping of rendered text.
- Animation: The property uses discrete animation behavior.
- Accessibility: Maintain readable typography and avoid excessive spacing adjustments.
- Browser support: The property is widely supported in modern browsers.
For most typography, font-kerning: normal is a straightforward way to request the kerning information provided by a font. Use none when kerning must be disabled, and auto when browser-controlled behavior is appropriate.
Browser Support
The CSS font-kerning property is Widely available in modern browsers, including Chrome, Edge, Firefox, and Safari.
The property controls whether font kerning is requested, but the actual visual result depends on the selected font and its kerning information.
Supported Example
h1 {
font-kerning: normal;
}
Feature Detection
@supports (font-kerning: normal) {
h1 {
font-kerning: normal;
}
}
The @supports rule checks whether the browser recognizes the declaration. It does not verify that a particular font provides kerning data.
Compatibility Considerations
Test kerning with the fonts and character combinations used on the website. Differences may be difficult to observe when a font contains limited kerning information or when the browser already applies kerning automatically.
For current compatibility information, visit Can I Use? and search for font-kerning.
Specifications
The font-kerning property is defined in the CSS Fonts Module, which describes font kerning behavior and its relationship with font feature selection.
CSS Fonts Module Level 4: font-kerning Property
Earlier specifications establish the property's basic values and behavior.
CSS Fonts Module Level 3: font-kerning Property
For additional explanations and examples, see MDN Web Docs.
