CSS font-language-override Property

The font-language-override property overrides the language system used for language-specific glyph substitutions in compatible OpenType fonts.

Some fonts contain different glyph forms or typographic substitutions for different languages. This property allows a developer to request a particular OpenType language system without changing the language assigned to the HTML content. It is a specialized typography feature with limited browser availability.

font-language-override Syntax

The font-language-override property accepts the keyword normal or a quoted OpenType language system tag.

Basic Syntax

selector {
  font-language-override: normal;
}

Specify a Language System

selector {
  font-language-override: "SRB";
}

The "SRB" value requests the Serbian OpenType language system when the selected font and browser support it.

Another Language System

selector {
  font-language-override: "TRK";
}

The "TRK" value requests the Turkish OpenType language system.

CSS-Wide Keywords

.example {
  font-language-override: inherit;
}
.example {
  font-language-override: initial;
}
.example {
  font-language-override: unset;
}
.example {
  font-language-override: revert;
}
.example {
  font-language-override: revert-layer;
}

The property does not accept a comma-separated list of language tags. Specify one language system tag or use normal.

Property Values

The property has two primary value forms.

Value Description
normal Uses the language system normally selected from the content's language information.
"language-tag" Requests the specified OpenType language system for font feature selection.

CSS-Wide Values

Value Description
inherit Uses the computed value of the parent element.
initial Restores the initial value, normal.
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 normal
Inherited Yes
Applies to All elements and text
Computed value As specified
Animation type Discrete
Percentages Not applicable

The language system tag is written as a CSS string containing four ASCII characters. OpenType language tags are commonly displayed as three letters followed by a space, although other four-character tags also exist.

How It Works

OpenType fonts can contain language-specific glyph substitutions and positioning rules. During text shaping, the browser selects the appropriate language system using the language information associated with the text.

Step 1: Identify the Text Language

<p lang="sr">Пример текста</p>

The lang attribute identifies the content as Serbian.

Step 2: Select a Font

p {
  font-family: "Example Cyrillic Font", serif;
}

The browser selects a suitable font for the characters.

Step 3: Override the Font Language System

p {
  font-language-override: "SRB";
}

In a supporting browser, this requests the Serbian OpenType language system regardless of the language system that would otherwise have been selected.

Step 4: Apply Available Font Features

If the font contains language-specific substitutions for the requested language system, those substitutions can affect the displayed glyphs.

Important Consideration

The property does not translate text, change Unicode characters, or modify the HTML language attribute. It only affects language-dependent font feature selection.

The normal Value

The normal value allows the browser to select the font language system using the text's language information.

Default Behavior

p {
  font-language-override: normal;
}

Using HTML Language Information

<p lang="tr">Türkçe metin örneği</p>
p {
  font-language-override: normal;
}

With normal, the browser can use the Turkish language information when selecting language-specific font features.

Reset an Override

.special-text {
  font-language-override: "TRK";
}
.special-text .default-language {
  font-language-override: normal;
}

Important Consideration

For most multilingual websites, the default behavior is preferable. Correct HTML language attributes allow browsers and assistive technologies to interpret the content appropriately.

OpenType Language Tags

OpenType language system tags identify language-specific shaping rules stored in a font. They are different from the language codes normally used in HTML.

Examples of Language System Tags

OpenType Tag Language CSS Example
SRB Serbian "SRB"
TRK Turkish "TRK"
ROM Romanian "ROM"
RUS Russian "RUS"
BGR Bulgarian "BGR"
DEU German "DEU"

In the OpenType registry, many three-letter tags include a trailing space to form four characters. CSS examples commonly use the three visible letters because trailing spaces are added during interpretation of shorter strings.

Serbian Example

.serbian-glyphs {
  font-language-override: "SRB";
}

Turkish Example

.turkish-glyphs {
  font-language-override: "TRK";
}

Important Consideration

Language system tags are not interchangeable with HTML language codes. Use the official OpenType language system tag rather than assuming that a two-letter HTML language code will work.

HTML Language vs. Font Language

HTML language information and OpenType font language selection serve different purposes.

HTML lang Attribute

<p lang="sr">Пример текста</p>

The HTML lang attribute identifies the language of the content. It can influence pronunciation, accessibility, spellchecking, and font shaping.

CSS font-language-override

p {
  font-language-override: "SRB";
}

The CSS property requests a particular OpenType language system for font rendering.

Comparison

Feature Purpose
lang Identifies the actual language of the HTML content.
font-language-override Overrides language-dependent OpenType font feature selection.

Using Both

<p lang="sr" class="alternate-font-language">Пример текста</p>
.alternate-font-language {
  font-language-override: "RUS";
}

The content remains identified as Serbian, but a supporting browser is instructed to use Russian OpenType language-specific substitutions where the selected font provides them.

Important Consideration

Do not change the HTML lang attribute merely to force a visual glyph variation. Language metadata should accurately describe the content.

Language-Specific Glyphs

Some writing systems use different preferred glyph forms for the same Unicode characters depending on the language.

Cyrillic Glyph Variations

Serbian, Russian, and Bulgarian typography can use different glyph designs for certain Cyrillic characters, particularly in italic typefaces.

Serbian Language System

.serbian-text {
  font-family: "Example Cyrillic Font", serif;
  font-language-override: "SRB";
}

Russian Language System

.russian-text {
  font-family: "Example Cyrillic Font", serif;
  font-language-override: "RUS";
}

Bulgarian Language System

.bulgarian-text {
  font-family: "Example Cyrillic Font", serif;
  font-language-override: "BGR";
}

Why the Difference Matters

Language-specific glyph forms can reflect established typographic conventions. Selecting the appropriate language system helps text follow those conventions when the font supports them.

Important Consideration

Not all fonts contain language-specific glyph variations. A font may render identical glyphs regardless of the requested language system.

Font Support and Fallback

The font-language-override property only affects rendering when the browser recognizes it and the selected font contains relevant language-specific OpenType features.

Font with Language-Specific Features

.example {
  font-family: "Example Multilingual Font", serif;
  font-language-override: "SRB";
}

If the font contains Serbian language-specific substitutions, those substitutions may be applied.

Font Without Language-Specific Features

.example {
  font-family: Arial, sans-serif;
  font-language-override: "SRB";
}

If the selected font lacks applicable substitutions, the text may appear unchanged.

Fallback Fonts

.example {
  font-family: "Preferred Font", "Fallback Font", serif;
  font-language-override: "SRB";
}

Different fallback fonts may contain different language-specific glyph forms or may not provide the requested features.

Custom Web Fonts

Fonts loaded using @font-face can contain OpenType language system data. Check the font documentation and supported languages before relying on specific substitutions.

Important Consideration

Browser support for the CSS property and font support for a particular language system are separate requirements. Both must be present for the override to affect rendering.

Relationship with font-feature-settings

The font-language-override and font-feature-settings properties both interact with OpenType font capabilities, but they control different aspects of text shaping.

Language System Selection

.example {
  font-language-override: "SRB";
}

This requests a particular OpenType language system.

Individual OpenType Features

.example {
  font-feature-settings: "liga" 1;
}

This requests the standard ligature feature.

Using Both Properties

.example {
  font-language-override: "SRB";
  font-feature-settings: "liga" 1;
}

The browser can use the requested language system when selecting language-dependent font features while also applying the explicitly requested ligature setting.

Comparison

Property Purpose
font-language-override Selects an OpenType language system for language-specific shaping.
font-feature-settings Enables, disables, or adjusts individual OpenType features.

Important Consideration

Use the property that matches the intended behavior. A language system override is not a replacement for individual feature settings, and neither property guarantees that the font contains the requested capabilities.

Inheritance

The font-language-override property is inherited, so descendants use the same value unless another declaration overrides it.

Set a Container Override

.text-container {
  font-language-override: "SRB";
}

Override a Child Element

.text-container {
  font-language-override: "SRB";
}
.text-container .default-language {
  font-language-override: normal;
}

Explicit Inheritance

.child {
  font-language-override: inherit;
}

Reset to the Initial Value

.child {
  font-language-override: initial;
}

The initial value is normal.

Important Consideration

Because the property is inherited, an override applied to a large container can affect multiple languages within that container. Apply language overrides narrowly when working with multilingual content.

font-language-override Example

This example compares the default language system with an explicitly requested Serbian OpenType language system. It uses Cyrillic text because certain Cyrillic fonts contain language-specific glyph variations.

The demonstration is intended to show the CSS syntax and fallback behavior. A visible difference requires a supporting browser and a font with suitable language-specific substitutions.

HTML Example

<div class="language-override-demo">
  <p class="demo-label">Default language system</p>
  <p class="demo-normal" lang="ru">Пример текста</p>
  <p class="demo-label">Serbian language override</p>
  <p class="demo-serbian" lang="ru">Пример текста</p>
  <p class="demo-label">Russian language override</p>
  <p class="demo-russian" lang="ru">Пример текста</p>
</div>

CSS Example

.language-override-demo {
  font-family: "Times New Roman", serif;
}
.language-override-demo p {
  margin: 0 0 12px;
}
.demo-label {
  font: 600 13px/1.4 Arial, sans-serif;
}
.demo-normal {
  font-size: 30px;
  font-style: italic;
  font-language-override: normal;
}
.demo-serbian {
  font-size: 30px;
  font-style: italic;
  font-language-override: "SRB";
}
.demo-russian {
  font-size: 30px;
  font-style: italic;
  font-language-override: "RUS";
}
Browser Result

Default language system

Пример текста

Serbian language override

Пример текста

Russian language override

Пример текста

The first line uses the language system normally selected for Russian text. The second requests Serbian language-specific font substitutions, while the third explicitly requests Russian substitutions.

All three lines may appear identical if the browser does not support the property or the selected font does not contain applicable language-specific glyph variations.

Common Mistakes

The most common problems involve confusing OpenType language system tags with HTML language codes or expecting unsupported font features to produce visible results.

Using an HTML Language Code

.example {
  font-language-override: "sr";
}

This uses the HTML-style language code rather than the intended OpenType language system tag. Use the appropriate OpenType tag, such as "SRB".

Omitting Quotation Marks

.example {
  font-language-override: SRB;
}

Language system tags must be written as quoted CSS strings.

Using Multiple Language Tags

.example {
  font-language-override: "SRB", "RUS";
}

The property does not accept a comma-separated list of language systems.

Expecting the Property to Translate Text

The property only influences language-specific font shaping. It does not translate words or change the underlying text.

Using the Override Instead of HTML lang

Always identify the actual language of content using the appropriate HTML language attribute. The CSS override does not replace language metadata.

Expecting Every Font to Support Language Variants

Many fonts do not contain language-specific substitutions for every OpenType language system.

Assuming Universal Browser Support

The property has limited browser availability. Unsupported browsers ignore the declaration and continue using their normal font language selection behavior.

Applying Overrides Too Broadly

An inherited override may affect text in multiple languages. Restrict the declaration to the elements that require it.

Important Considerations

Keep the following points in mind when using the font-language-override property:

  • Purpose: Overrides language-specific OpenType font feature selection.
  • Initial value: normal.
  • Inheritance: The property is inherited.
  • Applies to: All elements and text.
  • normal: Uses the language system normally selected from the text's language information.
  • Language tags: Uses OpenType language system tags rather than HTML language codes.
  • String syntax: Language system tags are written inside quotation marks.
  • Tag length: OpenType language system tags contain four ASCII characters, with shorter CSS strings padded as specified.
  • One language system: The property accepts one override value at a time.
  • Font dependency: The selected font must contain applicable language-specific substitutions.
  • Browser dependency: The browser must implement the property for the override to work.
  • Glyph selection: The property can change glyph forms without changing Unicode characters.
  • HTML language: Continue using the lang attribute to identify the actual content language.
  • Accessibility: The property does not change language metadata used by assistive technologies.
  • Multilingual content: Apply overrides narrowly to avoid affecting unrelated text.
  • OpenType features: The property selects a language system rather than enabling individual features.
  • Fallback fonts: Different fonts may provide different language-specific substitutions.
  • Animation: The property uses discrete animation behavior.
  • Compatibility: Browser support is limited compared with common CSS font properties.

For most websites, use correct HTML language attributes and allow the browser to select appropriate font language features automatically. Reserve font-language-override for specialized typography where a specific OpenType language system is required and compatibility limitations are acceptable.

Browser Support

The CSS font-language-override property has Limited availability and is not supported consistently across major browsers.

Firefox has implemented the property, while support in other browser engines is limited or unavailable. The declaration should not be relied upon for essential content presentation across all browsers.

Example Declaration

.example {
  font-language-override: "SRB";
}

Feature Detection

@supports (font-language-override: "SRB") {
  .example {
    font-language-override: "SRB";
  }
}

The @supports rule checks whether the browser recognizes the declaration. It does not guarantee that the selected font contains Serbian language-specific glyph substitutions.

Compatibility Considerations

When this property is unsupported, browsers generally ignore the declaration and use their normal language-based font shaping behavior. Correct HTML language metadata remains important for consistent fallback behavior.

For current compatibility information, visit Can I Use? and search for font-language-override.

Specifications

The font-language-override property is defined in the CSS Fonts Module, which describes language-specific font feature selection and the ability to override the language system used during text shaping.

CSS Fonts Module Level 4: font-language-override Property

Earlier specifications also describe the property's syntax and intended behavior.

CSS Fonts Module Level 3: font-language-override Property

OpenType language system tags are defined in the OpenType specification.

OpenType Language System Tags

For additional explanations and examples, see MDN Web Docs.

MDN Web Docs: font-language-override