Font-variant-caps - CSS Property

font-variant-caps

Summary of characteristics of the font-variant-caps property

Quick description
Applies character capitalization.
Status
Standard
Predefined values
normal | small-caps | petite-caps | titling-caps | unicase | all-small-caps | all-petite-caps
Percentages
Not applicable.
Initial value
normal
Inherited by default
Yes.
Discrète: during an animation, the font-variant-caps property passes from one value to another without transition.
Single: single value (no order).
W3C Module
CSS Fonts Module
 🡇  
 🡅  
Document status: WD (Working Draft)

Document status: REC (Recommendation)

Syntax diagram of font-variant-caps.

Font-variant-caps property - Syntax diagramSyntax diagram of the font-variant-caps CSS property. See stylescss.free.fr for details. normal normal small-caps small-caps all-small-caps all-small-caps petite-caps petite-caps all-petite-caps all-petite-caps unicase unicase titling-caps titling-capsfont-variant-caps:;font-variant-caps:;
Syntax diagram of the font-variant-caps property.
The links in the diagram provide more details about the values.
Download the diagram.

Description of the font-variant-caps property.

font-variant-caps sets the capitalization of characters: in small caps, in title case, etc.
In principle, these different character forms are defined by the font itself. Otherwise, the browser can simulate capitalization, though the result may not look as good.

See also the shorthand property font-variant, and font-synthesis-small-caps to allow or not the browser to simulate capitalization changes.

Values for font-variant-caps.

  • font-variant-caps: normal;

    Default value.
    The characters are displayed exactly as they are written in the HTML code.

    Example
  • font-variant-caps: small-caps;

    The characters have the shape of uppercase letters but the size of lowercase ones. However, the original uppercase height is still kept.

    The small-caps value is equivalent to font-feature-settings:'smcp'. See the font-feature-settings property for low-level use of OpenType font features.

    Example
  • font-variant-caps: all-small-caps;

    The characters have the shape of capital letters and the size of lowercase letters. Even letters that are originally uppercase are reduced to the size of lowercase letters.

    The value all-small-caps is equivalent to font-feature-settings:'c2sc'.

    Example
  • font-variant-caps: petite-caps;

    The characters are in the shape of small capitals and the size of lowercase letters. The size of letters that were originally capitalized is kept.

    If small caps aren't available in the font being used, the browser treats this value as small-caps.

    The value petite-caps is equivalent to font-feature-settings:'pcap'.

    Example
  • font-variant-caps: all-petite-caps;

    The characters are in small caps and the size of lowercase letters. Letters that are originally uppercase are also reduced to the size of lowercase letters.

    If small caps aren't available in the font being used, the browser treats this value as all-small-caps.

    The value all-petite-caps is equivalent to font-feature-settings:'c2pc'.

    Example
  • font-variant-caps: unicase;

    The characters have the shape of lowercase letters but the size of uppercase letters. For aesthetic reasons, some letters take the shape of uppercase letters: we can see this in our example with the letters H, L, T, but other letters also take on the uppercase glyph.

    If this option isn’t available in the font used, the browser simulates it by enlarging the lowercase letters.

    unicase therefore displays a combination of lowercase and uppercase letters, all at the height of uppercase letters.

    The unicase value is equivalent to font-feature-settings:'unic'.

    Example
  • font-variant-caps: titling-caps;

    Uppercase letters are designed to be used together with lowercase letters. In the case of titles written entirely in uppercase, the uppercase glyph isn’t always optimized: the letters can look too thick. titling-caps fixes this problem by switching to a set of thinner uppercase letters.

    If the font used doesn't support this option, using titling-caps won't have any visible effect.

    The value titling-caps is equivalent to font-feature-settings:'tilt'

    EXAMPLE
  • font-variant-caps: initial; (normal) font-variant-caps: inherit; font-variant-caps: revert; font-variant-caps: revert-layer; font-variant-caps: revert-rule; font-variant-caps: unset;

    See the following pages for more details: initial, inherit, revert, revert-layer, revert-rule, unset.

Animation of the font-variant-caps property.

Below is an example of what the animation of font-variant-caps can look like. You can notice a small detail that's not very well done with the apostrophe: it doesn't align with the top of the letter D.

Example of animation

Access the font-variant-caps property via a program

With Javascript, change the value of font-variant-caps.

In Javascript, here is an example of code to change the value of font-variant-caps. You can see that Javascript offers a syntax with the typical CSS-style notation, in kebab-case, and another syntax in camel-case, which is more common in Javascript.

Javascript
let el = document.getElementById('id'); el.style['font-variant-caps'] = 'unicase'; // or let el = document.getElementById('id'); el.style.fontVariantCaps = 'unicase';

With Javascript, read the value of font-variant-caps.

The code below gets the value of font-variant-caps assigned to an element through its style attribute. The value assigned via a CSS selector is not taken into account.

Javascript
let el = document.getElementById('id'); let value = el.style['font-variant-caps']; // or let el = document.getElementById('id'); let value = el.style.fontVariantCaps;

With Javascript, read the computed value of font-variant-caps.

The computed value is the one that results from the cascade of inheritances. Failing that, it will be the initial value, i.e. normal in the case of font-variant-caps.

Javascript
let el = document.getElementById('id'); let value = window.getComputedStyle(el).getPropertyValue('font-variant-caps');

With JQuery, read or change the value of font-variant-caps.

JQuery also lets you change or read the value of a property, with a shorter syntax than JavaScript.

JQuery

// Read the value:
$('#id').prop('font-variant-caps');
// Write the value:
$('#id').prop('font-variant-caps', 'unicase');
$('#id').prop('{font-variant-caps': 'unicase'});

With JQuery, read the computed value of font-variant-caps.

JQuery
let value = $('#id').css('font-variant-caps');

Other code examples.

Refer to the page Javascript and CSS for more examples of dynamically manipulating styles using a language.

Try it yourself.

The buttons below apply the entered value to the font-variant-caps property and then show either the value as it was applied or the computed value. In the case of font-variant-caps, the result will be the same since this property only accepts predefined values (no calculations on these values). However, if the entered value is incorrect, the assigned value will be empty, while the computed value will be the original value (normal in the case of font-variant-caps).

Simulator.

Police :

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

Browsers compatibility with font-variant-caps.

font-variant-caps is the oldest in the font-variant... property family. As a result, it is well recognized and well handled by all browsers.

Column 1
Browser support for the font-variant-caps property, which applies capitalization to the characters of the element.
1
font-variant-caps
property
Estimated overall support.
97%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

UC Browser pour Androïd

Opéra Mobile

QQ Browser

Baidu Browser

Samsung Internet

Safari

Safari sur IOS

Chrome

Edge

Firefox

Opéra

Chrome pour Androïd

Androïd Brower

Firefox pour Androïd

KaiOS Browser

Opéra mini

Historic of the font-variant-caps property.

  • 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-caps:
    Introduction of the font-variant-caaps property in this level 3 of the font specification.
    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-caps:
    No change to the font-variant-caps property.
    WD
    July 11, 2017
    Working Draft.
    CR
    PR
    REC
  • CSS Fonts Module Level 5

    WD
    June 29, 2021
    Working Draft.
    CR
    PR
    REC

See also, about fonts.

The CSS Fonts Module specification covers everything related to fonts, typography, using the features of modern font formats, downloading fonts, etc., that is to say, the following definitions:

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.