text-box
The text-box CSS property is a shorthand that corresponds to the text-box-trim and text-box-edge properties, which together specify the amount of space to trim from the block-start edge and block-end edge of a text element's block container.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 133 | 133 | 149 | 18.2 | 133 | 18.2 | |
| The text-box CSS property is a shorthand that corresponds to the text-box-trim and text-box-edge properties, which together specify the amount of space to trim from the block-start edge and block-end edge of a text element's block container. | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
| The text-box-edge CSS property specifies an amount of space to trim from a text element's block container. | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
auto | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
none | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
trim-both | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
trim-end | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
trim-start | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
normal | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
| CSS type | ||||||
| The enumerated data type defines keywords that specify font metrics representing specific regions on a font's block-start edge and block-end edge. Each keyword specifies a position of a font's over and/or under edge. | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
alphabetic | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
cap | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
ex | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
text | 133 | 133 | 149 | 18.2 | 133 | 18.2 |
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
- This browser only partially implements this feature
- Requires an experimental browser flag to be enabled
- Rendering not implemented (only parsing and serialization).
Syntax
/* Shorthand */
.precise {
text-box: trim-both cap alphabetic;
}
/* Specific styling */
.button-text {
text-box-trim: trim-both;
text-box-edge: cap alphabetic;
}
/* Trim top only */
.heading {
text-box: trim-start cap alphabetic;
} Live demo
Use cases
-
Using text-box
The text-box CSS property is a shorthand that corresponds to the text-box-trim and text-box-edge properties, which together specify the amount of space to trim from the block-start edge and block-end edge of a text element's block container.
Cautions
- Limited browser support. Check compatibility before use.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.