text-box-trim
Newly availableSince 202689% of users
A highly anticipated property that allows you to 'trim' the leading (built-in vertical space) from the top and bottom of a text block. This solves the long-standing problem of text not being perfectly centered vertically in buttons or containers.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since August 2026. Widely available around February 2029.
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
none- Inherited
- No
- Applies to
- block containers and inline boxes
- Animation type
- discrete
Quick example
.button {
/* Removes the extra whitespace above and below the text for perfect vertical centering */
text-box-trim: both;
text-box-edge: cap alphabetic;
}Values
nonetrim-starttrim-endtrim-bothtext-box-trim browser support
BaselineNewly availableSince 2026 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.Works in all modern browsers. May need a fallback for older browsers.
Usage89%of people can use this11% use a browser without it.
Browsers
133+
154+
18.2+
133+Mobile
133+Android
154+Android
18.2+iOS