• Web Developer
  • Posts
  • CSS Typography Properties You Might Not Know About

CSS Typography Properties You Might Not Know About

font-variant, initial-letter, font-variant-numeric, font-display, line-clamp, font-palette, text-wrap, hanging-punctuation

CSS offers powerful typography tools that help developers create more refined and readable web designs. In this article, we'll explore some lesser-known but potentially useful CSS properties.

1. font-variant

The font-variant property provides developers with robust control over font variants. Its primary use is to adjust the display of text to better fit specific design needs. A common application is to create small caps (small-caps), often used in formal settings where uppercase letters need to appear without being overly prominent.

In fact, font-variant is a shorthand for several other CSS properties:

For example, font-variant-ligatures manages how ligatures appear, while font-variant-east-asian deals with special character forms in East Asian fonts. This is particularly useful in multilingual projects where font usage can vary significantly across cultures.

2. initial-letter

The initial-letter property allows developers to create enlarged and sunken first letters, a design style commonly seen in print media like books and magazines where the first letter spans multiple lines to draw the reader's attention.

In web design, initial-letter can add visual interest to otherwise plain paragraphs, making it especially suited for long articles or blog content. By specifying the number of lines and height the letter occupies, you can achieve customized effects.

You can also combine this with font-weight to make the letter more visually striking. This property works for text in various languages, including those that emphasize the first letter, like French or German.

3. font-variant-numeric

The font-variant-numeric property gives you detailed control over how numbers are displayed, which is particularly useful when handling financial, scientific, or statistical data. Normally, numbers are displayed in proportional fonts (each digit having a different width), but sometimes you need monospaced digits to align numbers in tables, invoices, etc. This property supports several subproperties, including lining-nums, oldstyle-nums, proportional-nums, and tabular-nums.

For instance, in a financial report, using tabular-nums ensures that all digits occupy the same width, preventing misaligned figures.

If you're designing something with a historical feel, you might choose oldstyle-nums to display traditional numeral forms. These subtle typographical details may go unnoticed by the average user, but they contribute significantly to improving interface aesthetics and user experience.

4. font-display

The font-display property optimizes the loading experience of custom fonts. Typically, when using custom fonts, browsers wait until the font is fully loaded before displaying text. font-display controls this behavior, enhancing page performance and improving user experience. Key options include auto, block, swap, fallback, and optional. For example, swap shows system fonts while custom fonts load, and switches to the custom font once available, avoiding the "Flash of Invisible Text" (FOIT).

Subscribe to Premium to read the rest.

Become a paying subscriber of Premium to get access to this post and other subscriber-only content.

Already a paying subscriber? Sign In.

A subscription gets you:

  • • 🚀 Join 10K+ Subscribers and Grow Together with 500+ Members
  • • 📅 Latest Web Insights Every Wednesday and Sunday
  • • 🎯 Tailored Web Development Content to Help You Grow
  • • 💌 Exclusive Member Emails Every Saturday
  • • 🔓 Cancel Anytime, No Hassle