Every font reserves whitespace above and below glyphs for line-height calculations. That means padding or gap measured in a design tool like Figma never quite matches what a browser renders. The workaround has been lowering line-height to 1 or hand-tuning negative margins to cancel the invisible space.
`text-box-trim: trim-both` with `text-box-edge` (e.g. `cap alphabetic`) trims the box to the cap-height and baseline, bringing browser rendering much closer to Figma's "Trim vertical padding" option.
Check caniuse/MDN baseline for support. Without it, the only option is measuring font-specific negative margins by hand — and re-measuring whenever the font changes.
When to use
Reproducing Figma text spacing pixel-for-pixel, or vertically centering text precisely inside a button or badge.