CSS text-decoration-style 屬性

定義和用法

text-decoration-style 屬性設置文本裝飾的類型(實線、波浪線、點線、虛線、雙線)。

提示:同時請參閱 text-decoration 屬性,它是這三個屬性的簡寫屬性:

  • text-decoration-line
  • text-decoration-style
  • text-decoration-color

另請參閱:

CSS 教程:CSS 文本

HTML DOM 參考手冊:textDecorationStyle 屬性

實例

設置不同類型的 text-decoration 樣式:

div.a {
  text-decoration-line: underline;
  text-decoration-style: solid;
}
div.b {
  text-decoration-line: underline;
  text-decoration-style: wavy;
}
div.c {
  text-decoration-line: underline;
  text-decoration-style: double;
}
div.d {
  text-decoration-line: overline underline;
  text-decoration-style: wavy;
}

親自試一試

CSS 語法

text-decoration-style: solid|double|dotted|dashed|wavy|initial|inherit;

屬性值

描述
solid 默認值。線條顯示為單行。
double 線條顯示為雙線。
dotted 線條顯示為點線。
dashed 線條顯示為虛線。
wavy 線條顯示為波浪線。
initial 將此屬性設置為其默認值。參閱 initial
inherit 從其父元素繼承此屬性。參閱 inherit

技術細節

默認值: solid
繼承:
動畫制作: 不支持。請參閱:動畫相關屬性
版本: CSS3
JavaScript 語法: object.style.textDecorationStyle="wavy"

瀏覽器支持

表格中的數字注明了完全支持該屬性的首個瀏覽器版本。

帶 -moz- 的數字表示使用前綴的首個版本。

Chrome IE / Edge Firefox Safari Opera
57.0 79.0 36.0
6.0 -moz-
12.1 44.0