CSS text-box-trim Playground

Mr. Harun paints the same sign twice, one with text-box-trim: the browser measures the cap line and baseline, then the space above the letters and below the…

Why it matters

The space you see differs from the one you wrote, differs again per font, and a lowercase label looks too low. It used to be patched with different top and bottom padding per font (magic numbers). With trim, the padding you write is the space you see, in any font.

The key idea

A line is taller than its letters, trim cuts the rest

Common mistakes

Try it in this playground