Tailwind CSS - Font Variant Numeric



Tailwind CSS Font Variant Numeric is a predefined class used to easily adjust the specific shape, design, or representation of numeric styles and variants within text elements on a webpage.

Tailwind CSS Font Variant Numeric Classes

Below is a list of Tailwind CSS classes that specify different font variant numeric styles to improve the appearance of numeric text elements on webpages.

Class Properties
normal-nums font-variant-numeric: normal;
ordinal font-variant-numeric: ordinal;
slashed-zero font-variant-numeric: slashed-zero;
lining-nums font-variant-numeric: lining-nums;
oldstyle-nums font-variant-numeric: oldstyle-nums;
proportional-nums font-variant-numeric: proportional-nums;
tabular-nums font-variant-numeric: tabular-nums;
diagonal-fractions font-variant-numeric: diagonal-fractions;
stacked-fractions font-variant-numeric: stacked-fractions;

Functionality Of Tailwind CSS Font Variant Numeric Classes

  • normal-nums: This class displays regular numeric figures without any extra styling, suitable for general numerical content.
  • ordinal: This class formats numbers like 1st, 2nd, 3rd, etc., which is helpful for creating lists or rankings.
  • slashed-zero: This class replaces the usual dot inside the zero (0) with a slash (), making it easier to differentiate between the number zero '0' and the letter 'O'.
  • lining-nums: This class adjusts numerals to have uniform heights, matching them with uppercase letters, useful for consistent design presentation.
  • oldstyle-nums: This class shows numerals with different heights, often used in paragraphs or body text.
  • proportional-nums: This class adjusts the space between numerals based on their width, which makes them easier to read.
  • tabular-nums: This class aligns numerals in a tabular format, ensuring they are vertically aligned in columns.
  • diagonal-fractions: This class displays fractions with a diagonal line separating the numerator and denominator (like 1/2, 3/4).
  • stacked-fractions: This class presents fractions in a stacked format (like 12, 34), which improves how they are read and distinguished.

Tailwind CSS Variant Numeric Class Examples

Below are examples of Tailwind CSS Font Variant Numeric classes, which allow you to style numeric text in many ways to improve its readability and appearance on webpages.

Using Tailwind CSS for Variant Numeric Styling

This example shows how Tailwind CSS font variant numeric classes can be used to adjust the appearance of numeric text, using predefined classes for different styles and formats.




    



    

Tailwind CSS Font Variant Numeric

Applying normal-nums font variant: 12345

Applying ordinal font variant: 1st, 2nd, 3rd

Applying slashed-zero font variant: 012345

Applying lining-nums font variant: 1234567890

Applying oldstyle-nums: font variant: 1234567890

Applying proportional-nums font variant: 12345

Applying tabular-nums font variant: 12345

Applying diagonal-fractions font variant: 1/2, 3/4

Applying stacked-fractions font variant: 1/2, 2/3

Advertisements