Learn how to use the text-box-trim and text-box-edge properties in CSS to remove unnecessary whitespace above and below the content in text boxes. These properties are accessible via a feature flag in Chrome 128+ and Safari 16.4+, and help streamline design consistency by eliminating unwanted leading. Understand how to specify trimming from different edges and heights to achieve precise spacing and alignment without cumbersome calculations.

8m read timeFrom css-tricks.com
Post cover image
Table of contents
Trim above the cap height onlyTrim above the x-height and below the alphabetic baselineTrim below the alphabetic baseline only
3 Comments

Sort: