CSS text-decoration_下劃線
阿新 • • 發佈:2021-10-14
定義和用法
- text-decoration 屬性規定新增到文字的修飾。
- 修飾的的顏色屬性由color設定。
- 這個屬性允許對文字設定某種效果,如加下劃線。如果後代元素沒有自己的裝飾,祖先元素上設定的裝飾會“延伸”到後代元素中。不要求使用者代理支援 blink。
引數說明
引數的預設值為none。引數的可能值如下:
值 | 描述 |
none | 預設。定義標準的文字。 |
underline | 定義文字下的一條線。 |
overline | 定義文字上的一條線。 |
line-through | 定義穿過文字下的一條線。 |
blink | 定義閃爍的文字。 |
inherit | 規定應該從父元素繼承 text-decoration 屬性的值。 |
瀏覽器支援
瀏覽器 | Chrome | IE | FireFox | Safari | Opera |
支援版本 | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
例項
設定修飾文字的樣式:
1 .p1 { 2 text-decoration: none; 3 } 4 5 .p2 { 6 text-decoration: underline; 7 } 8 9 .p3 { 10 text-decoration: overline; 11 } 12 13 .p4 { 14 text-decoration: line-through; 15 } 16 17 .p5{ 18 text-decoration: blink; 19 }
顯示的樣式如下:
參考網址
- CSS text-decoration: https://www.w3school.com.cn/cssref/pr_text_text-decoration.asp