CKTIS / CSS
text-box-trim — trimming text box edges
The text-box-trim property trims a text box to metrics selected by text-box-edge, rather than removing characters or whitespace.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
text-box-trim: none | trim-start | trim-end | trim-both;text-box-trim selects sides to trim: none disables trimming, trim-start selects block-start, trim-end selects block-end, and trim-both selects both. Its initial value is none; it is not inherited.
In block containers, trimming targets the first and last formatted lines; in multicolumn layout, it targets each column. On inline boxes, it trims the content box. text-box-edge selects the metrics; cap alphabetic means cap height and the alphabetic baseline.
It neither removes characters nor acts as glyph clipping. Start and end depend on writing mode. The effect does not propagate through flex, grid or table formatting contexts.
This describes a draft specification, not an implementation guarantee. The example requires local verification; Chromium 152 compatibility has not been confirmed.
Examples
<!doctype html>
<meta charset="utf-8">
<title>text-box-trim</title>
<style>
.sample {
margin: 24px 0;
font: 48px/2 sans-serif;
text-box-edge: cap alphabetic;
background: #dceeff;
}
.trimmed { text-box-trim: trim-both; }
</style>
<div class="sample">HELLO</div>
<div class="sample trimmed">HELLO</div>Result
Two HELLO blocks. With the demonstrated trimming behavior supported, the second blue background is shorter, extending from the cap-height edge to the alphabetic baseline. Exact pixel heights depend on the font. Without support, the blocks can appear identical.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.