CSS Portal

CSS font-variant-numeric Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The font-variant-numeric property controls which numeric glyph shapes and spacing behaviors a user agent chooses from a font’s typographic features — for example, whether digits are treated as uniform-width for table alignment, proportionally spaced for running text, or replaced with old-style figures that blend with lowercase letterforms. It is a high-level, author-friendly way to request those number-related OpenType features without dealing directly with low-level feature tags. Because it operates at the typographic-feature level, its effect is visible in both glyph selection (which character outlines are used) and text metrics (widths and vertical alignment), which can change layout and visual rhythm.

This property is typically used where the visual role of numeric text differs from surrounding content: numeric columns or financial tables benefit from uniform-width digits for clear alignment, while body text may look more harmonious with proportional or old-style digits. It also influences how fractions and ordinal markers are rendered when the font offers specialized fraction or superscript/subscript glyphs, improving legibility and professional appearance. When a requested variant is not available in the chosen font, the user agent will fall back — either to the font’s default glyphs or to an alternative font — so visual results depend on the fonts specified via font-family and their feature support.

At the implementation level, font-variant-numeric maps to specific OpenType features; authors who need granular, feature-by-feature control can use the lower-level font-feature-settings, while the broader typographic grouping is also reachable through the shorthand font-variant. Keep in mind that enabling different numeric variants can affect text measurement and line layout — changing digit widths alters line breaks, justification, and column alignment — so it’s best to choose variants deliberately based on content type (tables, UI counters, running prose) and test with the actual fonts being used.

Finally, consider typographic consistency and accessibility: numeric variants that improve machine-readable alignment also help sighted users scan and compare figures quickly, whereas more decorative variants may improve aesthetics at the cost of compactness or alignment. When designing interfaces or documents where numbers carry meaning (financial data, dates, measurements), explicitly requesting appropriate numeric variants leads to clearer, more predictable presentation across platforms — provided the chosen fonts include the necessary typographic features.

Definition

Initial value
normal
Applies to
All elements
Inherited
Yes
Computed value
As specified
Animatable
No
JavaScript syntax
object.style.fontVariantNumeric

Interactive Demo

0
3.14
2.71

Syntax

font-variant-numeric: normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ] 

Values

  • normalNone of the features listed below are enabled.
  • <numeric-figure-values> = [ lining-nums | oldstyle-nums ]lining-nums - Enables display of lining numerals (OpenType feature: lnum).
    oldstyle-nums - Enables display of old-style numerals (OpenType feature: onum).
  • <numeric-spacing-values> = [ proportional-nums | tabular-nums ]proportional-nums - Enables display of proportional numerals (OpenType feature: pnum).
    tabular-nums - Enables display of tabular numerals (OpenType feature: tnum).
  • <numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ]diagonal-fractions - Enables display of lining diagonal fractions (OpenType feature: frac).
    stacked-fractions - Enables display of lining stacked fractions (OpenType feature: afrc).
  • ordinalEnables display of letter forms used with ordinal numbers (OpenType feature: ordn).
  • slashed-zeroEnables display of slashed zeros (OpenType feature: zero).

Example

<div class="example">
<h1>font-variant-numeric examples</h1>
<p>Default: <span class="default">0123456789 1/2 3/4 1st 0 O</span></p>
<p>Lining figures: <span class="lining">0123456789</span></p>
<p>Oldstyle figures: <span class="oldstyle">0123456789</span></p>
<p>Oldstyle + proportional: <span class="old-prop">0123456789</span></p>
<p>Tabular figures: <span class="tabular">0123456789</span></p>
<p>Proportional figures: <span class="proportional">0123456789</span></p>
<p>Diagonal fractions: <span class="diagonal">1/2 3/4</span></p>
<p>Stacked fractions: <span class="stacked">1/2 3/4</span></p>
<p>Ordinal formatting: <span class="ordinal">1st 2nd 3rd 21st</span></p>
<p>Slashed zero: <span class="slashed">0 O o</span></p>
</div>
.example {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.6;
  max-width: 720px;
  margin: 24px;
}

h1 {
  font-size: 20px;
  margin-bottom: 12px;
}

.default {
  /* default numeric rendering from the font */
}

.lining {
  font-variant-numeric: lining-nums;
}

.oldstyle {
  font-variant-numeric: oldstyle-nums;
}

.old-prop {
  font-variant-numeric: oldstyle-nums proportional-nums;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.proportional {
  font-variant-numeric: proportional-nums;
}

.diagonal {
  font-variant-numeric: diagonal-fractions;
}

.stacked {
  font-variant-numeric: stacked-fractions;
}

.ordinal {
  font-variant-numeric: ordinal;
}

.slashed {
  font-variant-numeric: slashed-zero;
}

Browser Support

The following information will show you the current browser support for the CSS font-variant-numeric property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!