-
Notifications
You must be signed in to change notification settings - Fork 22.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial review: Document the text-box-* properties #37738
base: main
Are you sure you want to change the base?
Conversation
Preview URLs (6 pages)External URLs (7)URL:
URL:
URL:
URL:
URL:
(comment last updated: 2025-02-05 11:31:38) |
I'm removing myself from review as "nowhere near as good as @estelle at evaluating CSS PRs". If you want to add me back for bandwidth or other reasons feel free to do so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone through all the staged pages, reading them as if I was a fresh developer learning about the topic 🙂 I also did a technical pass looking for accidents or wrong information and I can't find any.
Everything looks good to me!
I'm proud to see similar demo's to those in the Chrome post as well as similar guidance. Glad to know the information we provided has resonated 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partially edited. I don't think "leading" is the right word... so letting you review what we have thus far and decide.
|
||
The **`text-box-edge`** [CSS](/en-US/docs/Web/CSS) property specifies an amount of [leading](/en-US/docs/Glossary/Leading) to trim from text content. | ||
|
||
Leading differs across fonts, making consistent typesetting historically challenging on the web. `text-box-edge` — along with its counterpart property {{cssxref("text-box-trim")}}, which specifies which edge(s) to trim leading from — makes consistent typesetting easier to achieve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leading differs across fonts, making consistent typesetting historically challenging on the web. `text-box-edge` — along with its counterpart property {{cssxref("text-box-trim")}}, which specifies which edge(s) to trim leading from — makes consistent typesetting easier to achieve. | |
Text height differs between fonts, making consistent typesetting historically challenging on the web. The `text-box-edge` — along with its counterpart property {{cssxref("text-box-trim")}} — makes consistent typesetting easier to achieve by enabling trimming of extra spacing above or below text. With the {{cssxref("text-edge")}} properties, we can set the over and under edges for inline boxes. This enables vertically aligning text regardless of the font file's baseline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaving this one until we can clear up the earlier confusion. Leading must be involved — the relevant spec section is titled Trimming Leading Over/Under Text — but after your review, I'm just confused as to exactly how (although I suspect it is removed from just the start and end of the entire text box).
Again, @argyleink, I'd love to hear your thoughts on this.
|
||
## Description | ||
|
||
Font files specify an amount of space — termed leading — to be included above and below text, to contain capital letters, ascenders, descenders, etc., and provide spacing between lines. The amount of leading included varies between fonts, making it difficult to consistently set block-level text spacing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Font files specify an amount of space — termed leading — to be included above and below text, to contain capital letters, ascenders, descenders, etc., and provide spacing between lines. The amount of leading included varies between fonts, making it difficult to consistently set block-level text spacing. | |
Font files specify the space included above and below text, to contain capital letters, ascenders, descenders, etc. This in-font spacing ensures lines of text don't overlap by default. The amount of spacing included varies between fonts, making it difficult to consistently set block-level text spacing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'm leaving this until we clear up the confusion.
|
||
Font files specify an amount of space — termed leading — to be included above and below text, to contain capital letters, ascenders, descenders, etc., and provide spacing between lines. The amount of leading included varies between fonts, making it difficult to consistently set block-level text spacing. | ||
|
||
The `text-box-edge` property allows you to trim the leading from the start and/or end edge of the text. It does this by specifying a {{cssxref("<text-edge>")}} value that indicates the over edge and under edge to trim the leading to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `text-box-edge` property allows you to trim the leading from the start and/or end edge of the text. It does this by specifying a {{cssxref("<text-edge>")}} value that indicates the over edge and under edge to trim the leading to. | |
The `text-box-edge` property allows you to trim the spacing from the start and/or end edge of lines of text by specifying a {{cssxref("<text-edge>")}} value that indicates the over edge and under edge to trim the inline box. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we should get rid of this "leading" since that is between lines, not within the inline box. I'll stop editing here and give you a chance to marinate / agree / disagree / get a pint / get several pints ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaving this one just for now, until we clear up the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good
|
||
## Description | ||
|
||
Font files specify an amount of space, termed leading, to be included above and below text to provide spacing between lines. The amount of leading included varies between fonts, as does the space within the font (the height of the capital letter, ascenders, descenders, etc.), making it difficult to consistently set block-level text spacing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Font files specify an amount of space, termed leading, to be included above and below text to provide spacing between lines. The amount of leading included varies between fonts, as does the space within the font (the height of the capital letter, ascenders, descenders, etc.), making it difficult to consistently set block-level text spacing. | |
Font files specify an amount of space, or edge spacing, to be included above and below text to provide spacing between lines. The amount of edge spacing included varies between fonts, as does the space within the font (the height of the capital letter, ascenders, descenders, etc.), making it difficult to consistently set block-level text spacing. |
Likely not the right term either, but commenting so we know where/what to update.
|
||
We apply a `text-box` value of `trim-end cap alphabetic` to the first one. The {{cssxref("text-box-edge")}} value of `cap alphabetic` specifies to trim the over edge to the top of the capital letters and the under edge flush with the text baseline. However, because the {{cssxref("text-box-trim")}} value is set to `trim-end`, only the under edge is trimmed. | ||
|
||
We apply a `text-box` value of `trim-both ex alphabetic` to the second one. The {{cssxref("text-box-edge")}} value of `ex alphabetic` specifies to trim the over edge to the font's x-height (the top of the short lower-case letters) and the under edge flush with the text baseline. Because the {{cssxref("text-box-trim")}} value is set to `trim-both`, both the over _and_ under edge are trimmed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We apply a `text-box` value of `trim-both ex alphabetic` to the second one. The {{cssxref("text-box-edge")}} value of `ex alphabetic` specifies to trim the over edge to the font's x-height (the top of the short lower-case letters) and the under edge flush with the text baseline. Because the {{cssxref("text-box-trim")}} value is set to `trim-both`, both the over _and_ under edge are trimmed. | |
We apply a `text-box` value of `trim-both ex alphabetic` to the second paragraph. The {{cssxref("text-box-edge")}} value of `ex alphabetic` specifies trimming the over edge to the font's x-height (the top edge of short lower-case letters) and the under edge flush with the text baseline. Because the {{cssxref("text-box-trim")}} value is set to `trim-both`, both the over _and_ under edge are trimmed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applied this one, but made a couple of tweaks.
|
||
The **`<text-edge>`** {{glossary("enumerated")}} [data type](/en-US/docs/Web/CSS/CSS_Types) defines keywords that specify font metrics representing specific regions on a font's block-start edge and block-end edge that are to be manipulated in some way. It effectively does this by specifying a position for the font's over and/or under edge. | ||
|
||
The `text-edge` values are used in the {{cssxref("text-box-edge")}} property to define regions of spacing to trim from the block-start edge and block-end edge of specified text content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `text-edge` values are used in the {{cssxref("text-box-edge")}} property to define regions of spacing to trim from the block-start edge and block-end edge of specified text content. | |
The `<text-edge>` key terms are values of the {{cssxref("text-box-edge")}} property used to specify trim definitions from the block-start edge and block-end edge of text content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't like this suggestion very much. It is technically correct, but I think it will be significantly harder for readers to understand. I have elected to echo the definition from the text-box-edge
page, and keep it really simple:
The
<text-edge>
values are used in the {{cssxref("text-box-edge")}} property to specify an amount of space to trim from text content.
### Single keyword values | ||
|
||
- `text` | ||
- : The font's over and under edges are its start and end boundaries. This can be considered the default, as this is where the boundaries are normally without any manipulation. | ||
|
||
> [!NOTE] | ||
> The specification also defines the `ideographic` and `ideographic-ink` keywords, which are intended to represent over and under edge positions specific to [CJK language characters](https://en.wikipedia.org/wiki/CJK_characters). Currently their exact behavior is being debated and they are are not supported by any browser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: I would put single (and the note) above two keyword values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with you — that makes more logical sense for the flow. I've swapped the order over, and I've also swapped the order of the two bullets that precede those sections so that the one > two order is consistent everywhere.
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: Estelle Weyl <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Description
Chrome 133 and Safari 18.2 support the
text-box-*
properties from the CSS Inline Layout Module Level 3, which allow you to control how much space is trimmed from the start and/or end block edges of text content.This PR documents:
text-box-trim
andtext-box-edge
properties.text-box
shorthand equivalenttext-edge
datatypeleading
value. This is becauseleading
is not a<text-edge>
value — it's a separateline-fit-edge
value. I was initially confused by this because the<text-edge>
data type definition is included in theline-fit-edge
section (https://drafts.csswg.org/css-inline-3/#text-edges), and theleading
value definition is included in the list of<text-edge>
values, even though it isn't part of that data type.It also updates the CSS inline layout module page to make sure all of these things are linked appropriately.
Motivation
Additional details
ChromeStatus entry: https://chromestatus.com/feature/5174589850648576
Related issues and pull requests
BCD: mdn/browser-compat-data#25730