text-box

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.

It is documented as part of the CSS Inline specification.

/* Usage Example */
h2 {
  /* Trims both sides of the text box using capital letters and the baseline as bounds */
  text-box: trim-both cap alphabetic;
}

/* Syntax */
text-box: normal;
text-box: text-box-trim;
text-box: text-box-edge;

/* Global values */
text-box: inherit;
text-box: initial;
text-box: revert;
text-box: revert-layer;
text-box: unset;

This comparison shows how text-box works in a real project. View snippet →

Limited availability Since 2020 80% global usage

This feature is not Baseline because it does not work in some of the most widely-used browsers.

133+
18.2+
133+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC