• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Css Basic: font-variant-numeric

December 20, 2023

CSS Basic: font-variant-numeric

In the world of web design, typography plays a crucial role in creating visually appealing and user-friendly websites. CSS provides a wide range of properties to control the appearance of text, and one such property is font-variant-numeric. This property allows you to control the rendering of numeric characters within text elements. In this article, we will explore the various aspects of font-variant-numeric and how it can enhance your website’s typography.

Understanding font-variant-numeric

The font-variant-numeric property is a part of the CSS Fonts Module Level 4 specification. It allows you to control the rendering of numeric characters within text elements. By using this property, you can modify the appearance of numbers, such as changing the style of old-style numerals, lining numerals, or proportional numerals.

The font-variant-numeric property accepts various values, including:

  • normal: This is the default value, which renders the numbers using the default style defined by the font.
  • ordinal: This value renders numbers as ordinal indicators, such as 1st, 2nd, 3rd, etc.
  • slashed-zero: This value renders the number zero with a slash through it, differentiating it from the letter ‘O’.
  • lining-nums: This value renders numbers as lining numerals, which have a consistent height and align with uppercase letters.
  • oldstyle-nums: This value renders numbers as old-style numerals, which have varying heights and align with lowercase letters.
  • proportional-nums: This value renders numbers as proportional numerals, which have varying widths based on their individual shapes.

Examples of font-variant-numeric

Let’s take a look at some examples to understand how font-variant-numeric works:

/* Using old-style numerals */
p {
  font-variant-numeric: oldstyle-nums;
}

/* Using lining numerals */
h1 {
  font-variant-numeric: lining-nums;
}

/* Using slashed zero */
span {
  font-variant-numeric: slashed-zero;
}

In the above examples, the first rule applies the oldstyle-nums value to the paragraphs, rendering the numbers with varying heights and aligning them with lowercase letters. The second rule applies the lining-nums value to the headings, rendering the numbers with a consistent height and aligning them with uppercase letters. The third rule applies the slashed-zero value to the spans, rendering the number zero with a slash through it.

Conclusion

The font-variant-numeric property in CSS allows you to control the rendering of numeric characters within text elements. By using this property, you can modify the style of numbers, such as old-style numerals, lining numerals, or proportional numerals. Understanding and utilizing this property can greatly enhance the typography of your website, making it more visually appealing and user-friendly.

Learn More About Server.HK

If you are looking for reliable VPS hosting solutions in the Hong Kong, consider Server.HK. With a wide range of hosting plans and top-notch performance, Server.HK is a leading provider in the industry. Visit server.hk to learn more about their services and find the perfect hosting solution for your needs.

Recent Posts

  • CN2 GIA vs BGP vs CN2 GT: What’s the Real Difference for China Connectivity?
  • Top 5 Use Cases for a Hong Kong Dedicated Server in 2026
  • Hong Kong VPS vs Japan VPS: Head-to-Head for Asia-Pacific Deployments in 2026
  • Hong Kong VPS vs Singapore VPS: Which Is Better for Your Asia Business in 2026?
  • How to Migrate from CentOS 8 to AlmaLinux or Rocky Linux Safely

Recent Comments

No comments to show.

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot