text-box
Newly availableSince 202689% of users
The shorthand property for 'text-box-trim' and 'text-box-edge'. It provides a concise way to control how a text box's vertical space is calculated and trimmed.
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.
The old way and the modern waySee the snippet: Vertical text centering without padding hacks →
Old way 6 lines
.btn {
display: inline-flex;
align-items: center;
padding: 10px 20px;
padding-top: 8px;
}Modern 4 lines
.btn {
padding: 10px 20px;
text-box: trim-both cap alphabetic;
}See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
normal- Inherited
- No
- Applies to
- block containers and inline boxes
- Animation type
- discrete
Quick example
h2 {
/* Trims both sides of the text box using capital letters and the baseline as bounds */
text-box: trim-both cap alphabetic;
}Values
normaltext-box-trimtext-box-edgeRelated snippet
Vertical text centering without padding hacksTypography →text-box 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