text-decoration-skip

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

實驗性: 這是一項實驗性技術
在生產中使用此技術之前,請仔細檢查瀏覽器相容性表格

text-decoration-skip CSS 屬性設定元素內容中任何影響元素的文字裝飾必須跳過哪些部分。它控制由元素繪製的所有文字裝飾線,以及由其祖先繪製的任何文字裝飾線。

注意: 大多數其他瀏覽器正趨於支援更簡單的 text-decoration-skip-ink 屬性。

語法

css
/* 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: revert;
text-decoration-skip: revert-layer;
text-decoration-skip: unset;

none

不跳過任何內容。因此,文字裝飾繪製所有文字內容並跨越原子行內級框。

物件

如果元素是原子行內元素(例如影像或行內塊),則跳過元素的整個外邊距框。

空格

跳過所有間距:所有 Unicode 空格字元和所有單詞分隔符,以及任何相鄰的 letter-spacingword-spacing

leading-spaces

spaces 相同,但只跳過前導空格。

trailing-spaces

spaces 相同,但只跳過尾隨空格。

edges

文字裝飾的開始和結束從裝飾框的內容邊緣稍微向內縮排(例如,縮排線厚度的一半)。因此,相鄰元素會獲得單獨的下劃線。(這在中國很重要,因為下劃線是一種標點形式。)

An example of "text-decoration-skip: edges;".

box-decoration

文字裝飾跳過框的外邊距、邊框和內邊距區域。這僅對祖先施加的裝飾有效;裝飾框從不繪製在自己的框裝飾上。

正式定義

初始值物件
應用於所有元素
繼承性
計算值同指定值
動畫型別離散

正式語法

text-decoration-skip = 
none |
auto

示例

跳過邊緣

HTML

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

CSS

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

結果

規範

規範
CSS 文字裝飾模組第 4 級
# 文字裝飾跳過

瀏覽器相容性

另見