CKTIS / CSS
text-box-edge — text box trimming metrics
The text-box-edge property selects the font metrics used by text-box-trim. It does not enable trimming by itself or fit the box to the actual outline of each letter.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
text-box-edge: auto | <text-edge>;
<text-edge> = [ text | ideographic | ideographic-ink ] | [ text | ideographic | ideographic-ink | cap | ex ] [ text | ideographic | ideographic-ink | alphabetic ];text-box-edge specifies trimming edges, while text-box-trim enables trimming. It applies to block containers and inline boxes. Its initial value, auto, uses line-fit-edge, treating leading as text.
A pair of values specifies the over edge followed by the under edge. cap means cap height, ex means x-height, and alphabetic means the alphabetic baseline. text, ideographic, and ideographic-ink select the corresponding metric pairs; each of these three keywords can appear alone. Metrics are not the bounding outline of the currently displayed glyphs.
The property table and change log specify inheritance; a nearby draft note contradicts this. This document inconsistency calls for care when testing. Do not confuse this property with general control of spacing between lines.
The example compares an ordinary box with one trimmed to cap alphabetic. The example was run in Chromium. The check confirmed that the text in body matched the expected output, but did not verify the visual trimming effect. Support and layout still need to be checked in the target browser. Exact height depends on the font.
Examples
<!doctype html>
<meta charset="utf-8">
<title>text-box-edge</title>
<style>
.sample {
margin: 24px;
font: 48px/2 monospace;
outline: 1px solid;
background: #def;
}
.trimmed {
text-box-trim: trim-both;
text-box-edge: cap alphabetic;
}
</style>
<div class="sample">HELLO</div>
<div class="sample trimmed">HELLO</div>Result
HELLO HELLO
The example ran in an isolated instance of Chromium 157.0.8103.51 with external requests blocked. The check verified only that the text in `body` matched the expected output, not the visual trimming effect.