此屬性用於指定文本上裝飾的顏色(上劃線,下劃線和line-throughs)。
用法:
text-decoration-color:color|initial|inherit;
屬性值:
-
color:設置text-decoration的顏色。
用法:text-decoration-color:color;
例:
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>text-decoration</title> <style> h1 { color:green; } body { text-align:center; } table { margin:auto; } th { padding:10px 25px; } .underline { text-decoration:underline wavy; } .overline { text-decoration:overline solid; } .line-through { text-decoration:line-through double; } .red td { text-decoration-color:red; } .green td { text-decoration-color:green; } .blue td { text-decoration-color:blue; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2> text-decoration-color:color;</h2> <table> <tr> <th>underline</th> <th>line-through</th> <th>overline</th> </tr> <tr class="red"> <td class="underline">Hello Geeks!</td> <td class="line-through">Hello Geeks!</td> <td class="overline">Hello Geeks!</td> </tr> <tr class="green"> <td class="underline">Hello Geeks!</td> <td class="line-through">Hello Geeks!</td> <td class="overline">Hello Geeks!</td> </tr> <tr class="blue"> <td class="underline">Hello Geeks!</td> <td class="line-through">Hello Geeks!</td> <td class="overline">Hello Geeks!</td> </tr> </table> </body> </html>
輸出:
-
initial:將此屬性設置為其默認值。
用法:text-decoration-color:initial;
例:
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>text-decoration</title> <style> h1 { color:green; } body { text-align:center; } #example { text-decoration:underline double; text-decoration-color:initial; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2> text-decoration-color:initial;</h2> <div id="example"> This text-decoration-color of this text is set to initial. </div> </body> </html>
輸出:
- 穀歌瀏覽器57.0
- Firefox 36.0
- Opera 44.0
- Safari 7.1
支持的瀏覽器:text-decoration-color屬性支持的瀏覽器如下所示:
相關用法
- HTML Style textDecorationColor用法及代碼示例
- CSS transition-property用法及代碼示例
- CSS nav-up用法及代碼示例
- CSS top屬性用法及代碼示例
- CSS nav-right用法及代碼示例
- CSS nav-down用法及代碼示例
- CSS all屬性用法及代碼示例
- CSS right屬性用法及代碼示例
- CSS shape-outside用法及代碼示例
- CSS transform屬性用法及代碼示例
- CSS left屬性用法及代碼示例
- HTML DOMRect top用法及代碼示例
- HTML DOMRect right用法及代碼示例
- CSS min-height用法及代碼示例
- CSS perspective屬性用法及代碼示例
注:本文由純淨天空篩選整理自Archana choudhary大神的英文原創作品 CSS | text-decoration-color Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。