Tillitsdone
down Scroll to discover

CSS Font-Kerning Enhancing Text Readability

CSS font-kerning improves text readability and visual appeal by adjusting character spacing.

Available options include auto, normal, and none for better typography.
thumbnail

Introduction

The font-kerning CSS property helps control the spacing between specific pairs of characters in a font, making text more readable and visually appealing. This is particularly useful for headings and prominent text elements on a webpage.

Definition of Kerning

Kerning is a typographic technique that adjusts the spacing between individual characters to improve the overall appearance and readability of text. For example, in the pair “AV,” kerning slightly adjusts the space between these letters to create a more balanced look.

Syntax and Values

The font-kerning property is easy to use and offers several values to control the kerning of your text. Here’s a breakdown:

Syntax:

font-kerning: auto | normal | none;

Values:

  • auto: The default value. The browser decides whether to apply kerning based on the font and other factors.
  • normal: Always applies the kerning information stored in the font.
  • none: Disables kerning, ignoring any kerning information stored in the font.

Global Values:

  • inherit: Inherits the value from the parent element.
  • initial: Sets the property to its default value (auto).
  • revert: Reverts the property to the user agent stylesheet value.
  • revert-layer: Reverts the property to the value established by the user-agent stylesheet for the document language.
  • unset: Resets the property to its natural value.

Examples: Enabling and Disabling Kerning

HTML

<div id="kern"></div>
<div id="nokern"></div>
<textarea id="input">AV T. ij</textarea>

CSS

div {
font-size: 2rem;
font-family: serif;
}
#nokern {
font-kerning: none;
}
#kern {
font-kerning: normal;
}

JavaScript

const input = document.getElementById("input");
const kern = document.getElementById("kern");
const nokern = document.getElementById("nokern");
input.addEventListener("keyup", () => {
kern.textContent = input.value; /* Update content */
nokern.textContent = input.value;
});
kern.textContent = input.value; /* Initialize content */
nokern.textContent = input.value;

In this example, we have two <div> elements, one with font-kerning set to normal and the other with font-kerning set to none. A <textarea> is provided for you to input text and see the difference between kerned and non-kerned text in real time.

When you type into the <textarea>, the JavaScript code updates the content of both <div> elements, allowing you to compare the spacing of the text with and without kerning.

Specifications

The font-kerning property is defined in the CSS Fonts Module Level 4 specification. This module provides detailed information on how fonts should be handled and rendered in web browsers, including the application of kerning.

Browser Compatibility

The font-kerning property is widely supported across modern web browsers:

  • Google Chrome: Supported since version 33.0 (January 2014).
  • Microsoft Edge: Supported since version 79.0.
  • Mozilla Firefox: Supported since version 32.0 (December 2014).
  • Opera: Supported since version 20.
  • Safari: Supported since version 9.0 (October 2013).

Related Properties

Several other CSS properties can be used with font-kerning to further refine the appearance and readability of your text:

  • font-variant: Applies various typographic features like small caps and oldstyle numerals.
  • font-variant-position: Controls the position of superscripts and subscripts.
  • font-variant-east-asian: Specifically for East Asian typography, controlling features like ruby text.
  • font-variant-caps: Controls the use of capital letters, such as small caps.
  • font-variant-ligatures: Controls the use of typographic ligatures.
  • font-variant-numeric: Controls the use of numeric typographic features like oldstyle numerals.
  • font-variant-alternates: Applies alternative typographic features like stylistic sets.
  • font-synthesis: Controls the synthesis of bold and italic font styles.
  • letter-spacing: Controls the spacing between characters in your text.

FAQs

What is the font-kerning property in CSS?

The font-kerning property in CSS controls the use of kerning, which adjusts the space between specific pairs of characters to improve visual appeal and readability.

What values can font-kerning accept?

The font-kerning property accepts three values: auto, normal, and none. Auto applies the default kerning behavior based on the font, normal always applies kerning, and none disables kerning.

How does font-kerning improve typography?

Enabling kerning helps create more visually pleasing and readable text by adjusting the spacing between character pairs like “AV” or “To,” which can otherwise appear too tight or too loose.

Should I always enable font-kerning?

While kerning makes text look better, it’s usually best to set font-kerning to auto or normal. Most modern fonts already have optimal kerning values built in.

Is font-kerning widely supported?

Yes, font-kerning is supported in all modern browsers. However, older browsers might not fully support advanced kerning features, so it’s good to have fallback options.

By understanding and using the font-kerning property effectively, you can make the text on your website look much better and be more engaging for your users.

icons/css-4.svg CSS Blogs
CSS3 is the latest version of Cascading Style Sheets, offering advanced styling features like animations, transitions, shadows, gradients, and responsive design.
icons/logo-tid.svg

Talk with CEO

Ready to bring your web/app to life or boost your team with expert Thai developers?
Contact us today to discuss your needs, and let’s create tailored solutions to achieve your goals. We’re here to help at every step!
🖐️ Contact us
Let's keep in Touch
Thank you for your interest in Tillitsdone! Whether you have a question about our services, want to discuss a potential project, or simply want to say hello, we're here and ready to assist you.
We'll be right here with you every step of the way.
Contact Information
rick@tillitsdone.com+66824564755
Find All the Ways to Get in Touch with Tillitsdone - We're Just a Click, Call, or Message Away. We'll Be Right Here, Ready to Respond and Start a Conversation About Your Needs.
Address
9 Phahonyothin Rd, Khlong Nueng, Khlong Luang District, Pathum Thani, Bangkok Thailand
Visit Tillitsdone at Our Physical Location - We'd Love to Welcome You to Our Creative Space. We'll Be Right Here, Ready to Show You Around and Discuss Your Ideas in Person.
Social media
Connect with Tillitsdone on Various Social Platforms - Stay Updated and Engage with Our Latest Projects and Insights. We'll Be Right Here, Sharing Our Journey and Ready to Interact with You.
We anticipate your communication and look forward to discussing how we can contribute to your business's success.
We'll be here, prepared to commence this promising collaboration.
Frequently Asked Questions
Explore frequently asked questions about our products and services.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.