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

Đặt kiểu trang trí văn bản với CSS text-decoration-style


Để đặt kiểu trang trí văn bản, hãy sử dụng thuộc tính text-decoration-style. Bạn có thể dùng các giá trị sau:

text-decoration-style: solid | double | dotted | dashed | wavy | initial | inherit;

Ví dụ

<!DOCTYPE html> <html> <head> <style> span {    text-decoration: line-through;    text-decoration-color: blue; } .demo2 {    text-decoration: underline;    text-decoration-style: double;    text-decoration-color: red; } </style> </head> <body> <h1>Details</h1> <p class="demo">Examination Center near <span>XYZ College</span> ABC College.</p> <p class="demo2">Exam begins at 11AM.</p> </body> </html>

Kết quả

Đặt kiểu trang trí văn bản với CSS text-decoration-style

Ví dụ khác

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

<!DOCTYPE html> <html> <head> <style> .demo {    text-decoration: overline;    text-decoration-color: blue;    text-decoration-style: wavy; } .demo2 {    text-decoration: overline;    text-decoration-style: dashed;    text-decoration-color: red; } </style> </head> <body> <h1>Details</h1> <p class="demo">Examination Center near ABC College.</p> <p class="demo2">Exam begins at 11AM.</p> </body> </html>

Kết quả

Đặt kiểu trang trí văn bản với CSS text-decoration-style