Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> CSS

Đặt màu cho text decoration trong CSS


Để đặt màu cho trang trí văn bản (text decoration), hãy sử dụng thuộc tính text-decoration-color:

Ví dụ

<!DOCTYPE html> <html> <head> <style> .demo {    text-decoration: overline;    text-decoration-color: yellow; } </style> </head> <body> <h1>Examination Details</h1> <p class="demo">Exam on 20th December.</p> <p class="demo2">Exam begins at 9AM.</p> </body> </html>

Kết quả

Đặt màu cho text decoration trong CSS

Ví dụ khác

Xem thêm ví dụ dưới đây:

<!DOCTYPE html> <html> <head> <style> .demo {    text-decoration: underline;    text-decoration-color: orange; } </style> </head> <body> <h1>Details</h1> <p class="demo">Examination Center near ABC College.</p> <p class="demo2">Exam begins at 9AM.</p> </body> </html>

Kết quả

Đặt màu cho text decoration trong CSS