CSS text-decoration 属性
- 上一頁 text-align-last
- 下ー頁 text-decoration-color
定義和用法
text-decoration 屬性規定添加到文本的裝飾。
註釋:裝飾的顏色由 ‘color’ 屬性設定。
說明
這個屬性允許對文本設定某種效果,如加下劃線。如果後代元素沒有自己的裝飾,祖先元素上設定的裝飾會‘延伸’到後代元素中。不要求用戶代理支持 blink。
另請參考:
CSS 教程:CSS 文本
HTML DOM 參考手冊:textDecoration 屬性
實例
設定 h1、h2、h3、h4 元素的文本裝飾:
h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} h4 {text-decoration:blink;}
CSS 文法
text-decoration: text-decoration-line text-decoration-color text-decoration-style text-decoration-thickness|initial|inherit;
屬性值
值 | 描述 |
---|---|
text-decoration-line | 設定要使用的文本裝飾類型(如下劃線、上劃線、劃線)。 |
text-decoration-color | 設定文字裝飾的顏色。 |
text-decoration-style | 設定文本裝飾的樣式(如實心、波浪形、點線、虛線、雙線)。 |
text-decoration-thickness | 設定裝飾線的粗細。 |
initial | 將此屬性設定為其默認值。請參閱 initial。 |
inherit | 從其父元素繼承此屬性。請參閱 inherit。 |
技術細節
默認值: | none |
---|---|
繼承性: | no |
版本: | CSS1 |
JavaScript 文法: | object.style.textDecoration="overline" |
更多實例
- 裝飾文本
- 本例演示如何向文本添加裝飾。
瀏覽器支持
表格中的數字注明了完全支持該屬性的首个瀏覽器版本。
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
- 上一頁 text-align-last
- 下ー頁 text-decoration-color