Course contentsShow
← Web Development
Lesson 1305 of 2,98223. Web Font OptimizationFree lesson

The ascent-override, descent-override Properties

Fine-tuning vertical metrics of fallback fonts using CSS override properties to match web font line boxes.

The ascent-override, descent-override Properties

What you'll learn: How to surgically adjust the vertical spacing metrics of fallback fonts to perfectly match your web font's dimensions.


Why These Properties Exist

You've already learned about size-adjust for matching overall font heights and measuring ascent/descent values. But sometimes you need finer control. A fallback font might have the right overall size but the wrong vertical proportions—too much space above the baseline (ascent) or too much below (descent). This causes layout shifts when your web font finally loads.

How They Work

These CSS properties let you override the built-in vertical metrics of a fallback font:

@font-face {
  font-family: 'Fallback Arial';
  src: local('Arial');
  ascent-override: 90%;
  descent-override: 25%;
}

ascent-override controls how much space the font takes above the baseline (where capital letters and tall characters sit).

descent-override controls how much space extends below the baseline (where descenders like 'g', 'y', 'p' hang).

Think of it like adjusting the top and bottom margins inside an invisible box around each line of text—you're redistributing the vertical space to match your web font's exact proportions.

Matching Your Web Font

If your web font has an ascent of 880 units and descent of 220 units (out of 1000), but Arial's built-in values are 905/212, you'd calculate override percentages to match. Combined with size-adjust, these properties create a nearly perfect match.

Real-World Usage

@font-face {
  font-family: 'Roboto Fallback';
  src: local('Arial');
  size-adjust: 102%;
  ascent-override: 92%;
  descent-override: 24%;
}

Key Takeaway: Use ascent-override and descent-override in your fallback font declarations to precisely match your web font's vertical spacing, eliminating layout shift when fonts swap.