text-decoration-skip - CSS: Cascading Style Sheets 编辑

The text-decoration-skip CSS property sets what parts of an element’s content any text decoration affecting the element must skip over. It controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors.

Note: Most other browsers are converging on supporting the simpler text-decoration-skip-ink property.

/* Keyword values */
text-decoration-skip: none;
text-decoration-skip: objects;
text-decoration-skip: spaces;
text-decoration-skip: edges;
text-decoration-skip: box-decoration;

/* Multiple keywords */
text-decoration-skip: objects spaces;
text-decoration-skip: leading-spaces trailing-spaces;
text-decoration-skip: objects edges box-decoration;

/* Global values */
text-decoration-skip: inherit;
text-decoration-skip: initial;
text-decoration-skip: unset;

Syntax

Values

none
Nothing is skipped. Thus, text decoration is drawn for all text content and across atomic inline-level boxes.
objects
The entire margin box of the element is skipped if it is an atomic inline such as an image or inline-block.
spaces
All spacing is skipped: all Unicode white space characters and all word separators, plus any adjacent letter-spacing or word-spacing.
leading-spaces
The same as spaces, except that only leading spaces are skipped.
trailing-spaces
The same as spaces, except that only trailing spaces are skipped.
edges
The start and end of the text decoration is inset slightly (e.g., by half of the line thickness) from the content edge of the decorating box. Thus, adjacent elements receive separate underlines. (This is important in Chinese, where underlining is a form of punctuation.)
An example of "text-decoration-skip: edges;".
box-decoration
The text decoration is skipped over the box's margin, border, and padding areas. This only has an effect on decorations imposed by an ancestor; a decorating box never draws over its own box decoration.

Formal definition

Initial valueobjects
Applies toall elements
Inheritedyes
Computed valueas specified
Animation typediscrete

Formal syntax

none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]

Examples

Skipping edges

HTML

<p>Hey, grab a cup of <em>coffee!</em></p>

CSS

p {
  margin: 0;
  font-size: 3em;
  text-decoration: underline;
  text-decoration-skip: edges;
}

Result

Specifications

SpecificationStatusComment
CSS Text Decoration Module Level 4
The definition of 'text-decoration-skip' in that specification.
Working DraftInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:91 次

字数:7459

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文