大网数据广告活动
Web 标准与前端开发

`<text-edge>` CSS type

· 52CE 我爱测

The **`<text-edge>`** 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.

The <text-edge> 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.

The <text-edge> values are used in the text-box-edge property to specify an amount of space to trim from the block-start and block-end edge of a text element's block container.

Syntax

The <text-edge> data type is composed of one or two keywords representing specific regions on a font's block-start (over) edge and/or block-end (under) edge:

  • When one value is specified, the position of the font's over edge and under edge are specified using that same keyword.
  • When two values are specified, the first value specifies the position of the font's over edge, and the second value specifies the position of the font's under edge.

Values

Single keyword values

  • text
    • : The font's over and under edges are its text-over baseline/text-under baseline: this includes the font's ascenders and descenders but excludes the half-leading set on the text.

      [!NOTE] The amount of half-leading included on a text element can be controlled using the line-height property.

[!NOTE] The ideographic and ideographic-ink keywords are intended to specify over and under edge positions specific to CJK language characters. Currently their exact behavior is being debated and they are not supported by any browser.

Two keyword values

  • alphabetic
    • : The font's under edge is its alphabetic baseline, which is the bottom of its short lower-case letters (for example, "m", "n", and "o") or capital letters.
  • cap
    • : The font's over edge is its cap-height baseline, which is the top of its capital letters.
  • ex
    • : The font's over edge is its x-height baseline, which is the top of its short lower-case letters.
  • text
    • : The font's over edge is its text-over baseline (includes the font's ascenders but excludes the over edge half-leading), or its under edge is its text-under baseline (includes the font's descenders but excludes the under edge half-leading), depending on which edge the value is set for.

Formal syntax

Examples

See text-box-edge examples

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。