Font-variant-caps - CSS Property
Summary of characteristics of the font-variant-caps property
normal | small-caps | petite-caps | titling-caps | unicase | all-small-caps | all-petite-capsnormalDiscrète: during an animation, the font-variant-caps property passes from one value to another without transition.Single: single value (no order).Syntax diagram of font-variant-caps.
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-capsvalue is equivalent tofont-feature-settings:'smcp'. See thefont-feature-settingsproperty 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-capsis equivalent tofont-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-capsis equivalent tofont-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-capsis equivalent tofont-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.
unicasetherefore displays a combination of lowercase and uppercase letters, all at the height of uppercase letters.The
unicasevalue is equivalent tofont-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-capsfixes this problem by switching to a set of thinner uppercase letters.If the font used doesn't support this option, using
titling-capswon't have any visible effect.The value
titling-capsis equivalent tofont-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.
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.

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.

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.

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.

// 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.

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.
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.
font-variant-caps property, which applies capitalization to the characters of the element.font-variant-capsproperty
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 propertiesfont-...allow choosing the final appearance of the characters.
Fonts can be located on the user's computer or downloaded.Regardingfont-variant-caps:
Introduction of thefont-variant-caapsproperty in this level 3 of the font specification.July 21, 1997Working Draft.October 03, 2013Candidate Recommendation.August 14, 2018Proposed for recommendation.September 20, 2018Recommendation . -
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.
Regardingfont-variant-caps:
No change to thefont-variant-capsproperty.July 11, 2017Working Draft. -
CSS Fonts Module Level 5
June 29, 2021Working Draft.
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:






em, ex, etc.








Functions:

At-rules:



Descriptors :

@font-face. Sets the height of the characters above the baseline.

@font-face. Sets the height of the characters below the baseline.

@font-face. Determines how the browser behaves when faced with fonts that take a long time to load.

@font-face. Sets the line spacing of the font.

@font-face. Defines the range of character codes to be downloaded into a font.


