CSS text-decoration-color Property

Thuộc tính CSS text-decoration-color dùng để chỉ định màu sắc cho trang trí văn bản.

Cú pháp

text-decoration-color: color | initial | inherit;

Giá trị thuộc tính

Giá trị

Mô tả

color

Đặt màu cho text-decoration.

initial

Đặt thuộc tính về giá trị mặc định của nó.

inherit

Kế thừa thuộc tính từ phần tử cha của nó.

Ví dụ: 

html
<!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>

Đầu ra:

css-text-decoration-color-propertyVí dụ: 

html
<!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>

Đầu ra:

css-text-decoration-color-property

Trình duyệt được hỗ trợ

Các trình duyệt được hỗ trợ bởi CSS text-decoration-color Property được liệt kê dưới đây: 

  • Google Chrome 57.0
  • Edge 79.0
  • Firefox 36.0
  • Opera 44.0
  • Safari 12.1

Last Updated : 21/07/2025