Font-variant - CSS Property

font-variant

Summary of characteristics of the font-variant property

Quick description
Shorthand to define advanced typographic attributes: ligatures, character substitution, etc.
Status
Standard
Predefined values
normal | none | small-caps | all-small-caps | petite-caps | all-petite-caps | titling-caps | unicase
Percentages
Not applicable.
Initial value
normal
Inherited by default
Yes.
Discrète: during an animation, the font-variant property passes from one value to another without transition.
Per grammar: serialization in the order of syntax. Values can be entered in any order.
W3C Module
CSS Fonts Module
 🡇  
 🡅  
Document status: WD (Working Draft)

Document status: REC (Recommendation)

Document status: REC (Recommendation)

Description of the font-variant property.

Initially, in CSS2, the font-variant property simply defined the capitalization of characters (like small caps, for example). But it has evolved a lot: in CSS3, font-variant defines many advanced typographic settings such as ligatures or character substitution. It is now a shorthand property that corresponds to the following properties:

Enables or disables character ligation.
Superscript or subscript of characters.
Applies character capitalization.
Defines how evolved numbers are displayed: fractions, numbers, etc.
Defines character substitution (OTF, WOFF fonts).
Typography specific to Chinese or Japanese characters.
Choose between an emoji or text presentation.

Not all values are necessarily specified, but those that aren't will be reset to their initial value. So ignoring a value doesn't leave it unchanged.

font-variant et les propriétés dérivées ci-dessus fonctionnent avec les polices du type OTF, WOFF ou WOFF2.

Exemples de Values for font-variant.

  • font-variant: normal;

    Default value. The normal value initializes all individual font-variant properties to their initial value.

  • font-variant: none;

    The value none sets the font-variant-ligatures property to none and all the other individual properties to their initial value.

  • font-variant: common-ligatures small-caps oldstyle-nums ;

    Example of a syntax defining the value of several individual properties. This writing is equivalent to:

    font-variant-ligatures: common-ligatures; font-variant-position: initial; font-variant-caps: small-caps; font-variant-numeric: oldstyle-nums; font-variant-alternates: initial; font-variant-east-asian: initial; font-variant-emoji: initial;
  • font-variant: initial; (normal) font-variant: inherit; font-variant: revert; font-variant: revert-layer; font-variant: revert-rule; font-variant: unset;

    Common values ​​are presented on these pages: initial, inherit, revert, revert-layer, revert-rule, unset.

Animation of the font-variant property.

All properties related to font-variant can be animated. Check each property's page to see examples of animations.

Simulator.

The simulator only offers values already defined in CSS2, which are generally well recognized by all browsers and can be used with all fonts. But all values related to individual font-variant... properties are also accepted by the shorthand property font-variant. Check out these different properties for more details and other simulators.

font-variant :
The quick brown fox jumps over the lazy dog..

Browsers compatibility with font-variant..

The older values of font-variant (defined in CSS2) are well recognized by all current browsers. These are basically the values corresponding to font-variant-caps (normal, small-caps, all-small-caps, etc.). On the other hand, the new possibilities defined in CSS3 are less widely supported. Check the pages for individual properties for more details:

Moreover, all these features use the capabilities of OTF (OpenType Font) fonts, so they are very dependent on the font being used. Few fonts offer all the possibilities.

Column 1
Support by browsers of the font-variant property. Shorthand property for all properties whose name starts with font-variant-....

Notes:

(1) Only supports the small-caps and normal values.

1
font-variant
property
(CSS 2)
Estimated overall support.
98%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

KaiOS Browser

Opéra Mobile

Opéra

Safari

Safari sur IOS

Firefox pour Androïd

Samsung Internet

Chrome

Edge

Firefox

Androïd Brower

Chrome pour Androïd

Baidu Browser

QQ Browser

UC Browser pour Androïd

Opéra mini

Historic of the font-variant property.

  • Cascading Style Sheets specification - Version 1

    This first level of the CSS specification describes the mechanism of cascading style sheets. Authors and readers can add styles to documents. Mainly intended for formatting HTML documents, CSS allows defining colors, fonts, text formatting, spacing (margins), etc. The CSS language is easy to understand, readable, and easy to write; it uses common terms from desktop publishing.

    Regarding font-variant:
    First definition of the font-variant property, accepting only the values ​​normal and small-caps.
    WD
    November 17, 1995
    Working Draft.
    PR
    November 12, 1996
    Proposed for recommendation.
    REC
    December 17, 1996
    Recommendation .
    DEPR
    September 13, 2018
    Old specification, declared obsolete.
  • Cascading Style Sheets Level 2 - Revision 1 Specification

    This level 2 of the specification describes the mechanism of cascading styles in CSS. This language is used to format HTML or XML documents. It supports media-specific style sheets so that authors can adapt the presentation of their documents for visual browsers, auditory devices, printers, braille devices, portable devices, etc.

    Regarding font-variant:
    Adding inherit value.
    WD
    November 04, 1997
    Working Draft.
    PR
    March 24, 1998
    Proposed for recommendation.
    REC
    May 11, 1998
    Recommendation .
  • CSS Fonts Module Level 3

    This specification concerns fonts. A font contains the visual representation of characters. In its simplest form, it is just a matter of associating character codes with their shapes.
    Within a typeface family, the shapes are defined but can vary in stroke thickness, slant, width, etc. The CSS properties font-... allow choosing the final appearance of the characters.
    Fonts can be located on the user's computer or downloaded.

    Regarding font-variant:
    font-variant is now a shorthand property for setting values ​​for properties whose names start with font-variant....
    WD
    July 21, 1997
    Working Draft.
    CR
    October 03, 2013
    Candidate Recommendation.
    PR
    August 14, 2018
    Proposed for recommendation.
    REC
    September 20, 2018
    Recommendation .
  • CSS Fonts Module Level 4

    This level 4 of the specification on fonts reprises what is defined in level 3. It adds the possibility to define what happens when a font takes a long time to load or is missing. It also adds support for colored fonts and clarifies many points still poorly defined in level 3.

    Regarding font-variant:
    No change regarding the font-variant specification.
    WD
    July 11, 2017
    Working Draft.
    CR
    PR
    REC

About fonts, see also...

The CSS Fonts Module specification covers everything related to fonts, typography, making the most of modern font formats, font downloads, and so on.

Properties:

font
Langue française
Shorthand to set most properties for fonts.
✗
font-effect
Langue française
Allows you to apply some effects to the text: relief, border...
font-family
Selects a font from those that are available or downloaded.
⚠
font-feature-settings
Langue française
Permet d’exploiter les fonctionnalités spécifiques des polices de caractères OTF, WOFF, etc.
font-kerning
Adjusting the kerning between characters.
⚠
font-language-override
Langue française
Defines the language to be considered when choosing characters.
⚠
font-optical-sizing
Langue française
Optimizes the shape of characters based on their size.
font-palette
Langue française
Defines the color palette that can be used for colored fonts.
font-size
Adjusts the font size, which also impacts units like em, ex, etc.
font-size-adjust
Langue française
Definition of the aspect factor of the font.
✗
font-smooth
Langue française
Defines whether and which smoothing algorithm should be used.
font-stretch
Langue française
Changes the stretching or compression of characters.
font-style
Langue française
Selects the italic or oblique font styles.
font-synthesis
Allows or disallows calculation of missing styles in the typeface.
⚠
font-synthesis-position
Langue française
Whether or not allows the browser to synthesize characters in superscript or subscript.
font-synthesis-small-caps
Langue française
Whether or not allows the browser to calculate the glyphs of characters in small caps.
font-synthesis-style
Langue française
Defines whether the browser is allowed to synthesize italic forms of characters.
font-synthesis-weight
Langue française
Defines whether or not the browser can calculate the bold glyph.
Font-variant
Shorthand to define advanced typographic attributes: ligatures, character substitution, etc.
font-variant-alternates
Defines character substitution (OTF, WOFF fonts).
font-variant-caps
Applies character capitalization.
font-variant-east-asian
Typography specific to Chinese or Japanese characters.
⚠
font-variant-emoji
Choose between an emoji or text presentation.
font-variant-ligatures
Enables or disables character ligation.
font-variant-numeric
Defines how evolved numbers are displayed: fractions, numbers, etc.
⚠
font-variant-position
Superscript or subscript of characters.
font-variation-settings
Provides access to the stylistic possibilities of OTF fonts.
font-weight
Selects a weight for the characters.
font-width
Langue française
Synonymous with font-stretch (character width/enlargement).

Functions:

⚠
palette-mix()
Langue française
Establish the mixture of two color palettes from two different typefaces.

At-rules:

@font-face
Langue française
Defines all settings for a downloadable font.
⚠
@font-feature-values
Langue française
Defines the typographic variations to use.
@font-palette-values
Langue française
Defines a color palette that can then be applied to a font.

Descriptors :

ascent-override
Langue française
Descriptor for @font-face. Sets the height of the characters above the baseline.
descent-override
Langue française
Descriptor for @font-face. Sets the height of the characters below the baseline.
⚠
font-display
Langue française
Descriptor for @font-face. Determines how the browser behaves when faced with fonts that take a long time to load.
line-gap-override
Langue française
Descriptor for @font-face. Sets the line spacing of the font.
src
Langue française
Defines the source of a font file to download, or an image to display.
unicode-range
Langue française
Descriptor for @font-face. Defines the range of character codes to be downloaded into a font.