Skip to content

Font Variant Numeric

Use font-variant-numeric utilities to enable special numeric glyphs in fonts that support them. The utilities are composable — combine them to enable multiple variants at once.


Use the ordinal utility to enable special glyphs for ordinal markers:

Style('ordinal ...', child: Text('1st'))

Use the slashed-zero utility to force a zero with a slash:

Style('slashed-zero ...', child: Text('0'))

Use the lining-nums utility to use numeric glyphs aligned by their baseline:

Style('lining-nums ...', child: Text('1234567890'))

Use the oldstyle-nums utility to use numeric glyphs where some numbers have descenders:

Style('oldstyle-nums ...', child: Text('1234567890'))

Use the proportional-nums utility to use numeric glyphs that have proportional widths:

Style('proportional-nums ...', child: Text('12121'))
Style('proportional-nums ...', child: Text('90909'))

Use the tabular-nums utility to use numeric glyphs that have uniform/tabular widths:

Style('tabular-nums ...', child: Text('12121'))
Style('tabular-nums ...', child: Text('90909'))

Use the diagonal-fractions utility to replace numbers separated by a slash with diagonal fractions:

Style('diagonal-fractions ...', child: Text('1/2 3/4 5/6'))

Use the stacked-fractions utility to replace numbers separated by a slash with stacked fractions:

Style('stacked-fractions ...', child: Text('1/2 3/4 5/6'))

The utilities are composable so you can enable multiple variants by combining them:

Style('...', children: [
Style('...', child: Text('Subtotal')),
Style('text-right slashed-zero tabular-nums ...', child: Text('\$100.00')),
Style('...', child: Text('Tax')),
Style('text-right slashed-zero tabular-nums ...', child: Text('\$14.50')),
Style('...', child: Text('Total')),
Style('text-right slashed-zero tabular-nums ...', child: Text('\$114.50')),
])

Use the normal-nums property to reset numeric font variants. The reset emits an empty fontFeatures list so it overrides any inherited values:

<p class="slashed-zero tabular-nums md:normal-nums ..."></p>
ClassOpenType Feature
normal-numsreset (empty fontFeatures)
ordinalordn
slashed-zerozero
lining-numslnum
oldstyle-numsonum
proportional-numspnum
tabular-numstnum
diagonal-fractionsfrac
stacked-fractionsafrc
  • slashed-zero — tailwindcss.com’s font-source demos are served by a legacy, non-variable “Source Sans Pro” font file whose slashed-zero glyph is a small dot inside the counter. This app (and its parity ref-renderer) bundle the current Source Sans 3 font instead, whose slashed-zero glyph is a full diagonal stroke across the whole counter — a genuine type-design change present in every Source Sans 3 release, not a rendering bug. Source Sans 3 is required so smcp and onum combine correctly elsewhere on this page (the legacy Source Sans Pro file silently drops onum under smcp), so the bundled font is not swapped back to match tailwindcss.com’s zero glyph.