font-variant-position CSS property

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2023.

* Some parts of this feature may have varying levels of support.

The font-variant-position CSS property controls the use of alternate, smaller glyphs that are positioned as superscript or subscript.

The glyphs are positioned relative to the baseline of the font, which remains unchanged. These glyphs are typically used in <sub> and <sup> elements.

When the usage of these alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs.

These alternate glyphs share the same em-box and the same baseline as the rest of the font. They are merely graphically enhanced, and have no effect on the line-height and other box characteristics.

Syntax

css
/* Keyword values */
font-variant-position: normal;
font-variant-position: sub;
font-variant-position: super;

/* Global values */
font-variant-position: inherit;
font-variant-position: initial;
font-variant-position: revert;
font-variant-position: revert-layer;
font-variant-position: unset;

The font-variant-position property is specified as one of the keyword values listed below.

Values

normal

Deactivates alternate superscript and subscript glyphs.

sub

Activates subscript alternate glyphs. If, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs.

super

Activates superscript alternate glyphs. If, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs.

Formal definition

Initial valuenormal
Applies toall elements and text. It also applies to ::first-letter and ::first-line.
Inheritedyes
Computed valueas specified
Animation typediscrete

Formal syntax

font-variant-position = 
normal |
sub |
super

Examples

Setting superscript and subscript forms

HTML

html
<p class="normal">Normal!</p>
<p class="super">Super!</p>
<p class="sub">Sub!</p>

CSS

css
p {
  display: inline;
}

.normal {
  font-variant-position: normal;
}

.super {
  font-variant-position: super;
}

.sub {
  font-variant-position: sub;
}

Result

Specifications

Specification
CSS Fonts Module Level 4
# font-variant-position-prop

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
font-variant-position
Chrome – Full support
Chrome 117 (Release date: 2023-09-12)
footnote Full support
Edge – Full support
Edge 117 (Release date: 2023-09-15)
footnote Full support
Firefox – Full support
Firefox 34 (Release date: 2014-12-01)
footnote Full support
Opera – Full support
Opera 103 (Release date: 2023-10-03)
footnote Full support
Safari – Full support
Safari 9.1 (Release date: 2016-03-21)
footnote Full support
Chrome Android – Full support
Chrome Android 117 (Release date: 2023-09-12)
footnote Full support
Firefox for Android – Full support
Firefox for Android 34 (Release date: 2014-12-01)
footnote Full support
Opera Android – Full support
Opera Android 78 (Release date: 2023-10-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 9.3 (Release date: 2016-03-21)
footnote Full support
Samsung Internet – Full support
Samsung Internet 24 (Release date: 2024-01-25)
footnote Full support
WebView Android – Full support
WebView Android 117 (Release date: 2023-09-12)
footnote Full support
WebView on iOS – Full support
WebView on iOS 9.3 (Release date: 2016-03-21)
footnote Full support
normal
Chrome – Full support
Chrome 117 (Release date: 2023-09-12)
footnote Full support
Edge – Full support
Edge 117 (Release date: 2023-09-15)
footnote Full support
Firefox – Full support
Firefox 34 (Release date: 2014-12-01)
footnote Full support
Opera – Full support
Opera 103 (Release date: 2023-10-03)
footnote Full support
Safari – Full support
Safari 9.1 (Release date: 2016-03-21)
footnote Full support
Chrome Android – Full support
Chrome Android 117 (Release date: 2023-09-12)
footnote Full support
Firefox for Android – Full support
Firefox for Android 34 (Release date: 2014-12-01)
footnote Full support
Opera Android – Full support
Opera Android 78 (Release date: 2023-10-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 9.3 (Release date: 2016-03-21)
footnote Full support
Samsung Internet – Full support
Samsung Internet 24 (Release date: 2024-01-25)
footnote Full support
WebView Android – Full support
WebView Android 117 (Release date: 2023-09-12)
footnote Full support
WebView on iOS – Full support
WebView on iOS 9.3 (Release date: 2016-03-21)
footnote Full support
sub
Chrome – Partial support
Chrome 117 (Release date: 2023-09-12)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Edge – Partial support
Edge 117 (Release date: 2023-09-15)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Firefox – Full support
Firefox 34 (Release date: 2014-12-01)
footnote Full support
Opera – Partial support
Opera 103 (Release date: 2023-10-03)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Safari – Partial support
Safari 9.1 (Release date: 2016-03-21)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 151471).
Chrome Android – Partial support
Chrome Android 117 (Release date: 2023-09-12)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Firefox for Android – Full support
Firefox for Android 34 (Release date: 2014-12-01)
footnote Full support
Opera Android – Partial support
Opera Android 78 (Release date: 2023-10-23)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Safari on iOS – Partial support
Safari on iOS 9.3 (Release date: 2016-03-21)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 151471).
Samsung Internet – Partial support
Samsung Internet 24 (Release date: 2024-01-25)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 352218916).
WebView Android – Partial support
WebView Android 117 (Release date: 2023-09-12)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 352218916).
WebView on iOS – Partial support
WebView on iOS 9.3 (Release date: 2016-03-21)
footnote Partial support
footnote If the font does not have subscript glyphs, then substitute characters are not synthesized (see bug 151471).
super
Chrome – Partial support
Chrome 117 (Release date: 2023-09-12)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Edge – Partial support
Edge 117 (Release date: 2023-09-15)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Firefox – Full support
Firefox 34 (Release date: 2014-12-01)
footnote Full support
Opera – Partial support
Opera 103 (Release date: 2023-10-03)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Safari – Partial support
Safari 9.1 (Release date: 2016-03-21)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 151471).
Chrome Android – Partial support
Chrome Android 117 (Release date: 2023-09-12)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Firefox for Android – Full support
Firefox for Android 34 (Release date: 2014-12-01)
footnote Full support
Opera Android – Partial support
Opera Android 78 (Release date: 2023-10-23)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 352218916).
Safari on iOS – Partial support
Safari on iOS 9.3 (Release date: 2016-03-21)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 151471).
Samsung Internet – Partial support
Samsung Internet 24 (Release date: 2024-01-25)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 352218916).
WebView Android – Partial support
WebView Android 117 (Release date: 2023-09-12)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 352218916).
WebView on iOS – Partial support
WebView on iOS 9.3 (Release date: 2016-03-21)
footnote Partial support
footnote If the font does not have superscript glyphs, then substitute characters are not synthesized (see bug 151471).

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support

See also