Thuộc tính kiểu textDecorationLine
Ví dụ
Hiển thị một phần tử có một dòng xuyên qua văn bản:
document.getElementById("demo").style.textDecorationLine = "line-through";
Hãy tự mình thử »Sự miêu tả
Thuộc tính textDecorationLine đặt hoặc trả về loại đường, nếu có, phần trang trí sẽ có.
Lưu ý: Bạn cũng có thể đặt textDecorationLine bằng cách sử dụng thuộc tính textDecoration, đây là thuộc tính viết tắt cho các thuộc tính textDecorationLine, textDecorationStyle và textDecorationColor.
Lưu ý: Bạn cũng có thể kết hợp nhiều giá trị, chẳng hạn như gạch chân và gạch chân để hiển thị các dòng cả bên dưới và bên trên văn bản.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
textDecorationLine | 57.0 | 79.0 | 36.0 | 7.0 Webkit | 44.0 |
Cú pháp
Trả về thuộc tính textDecorationLine:
object .style.textDecorationLine
Đặt thuộc tính textDecorationLine:
object .style.textDecorationLine = "none|underline|overline|line-through|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
none | Default value. Specifies no line for the text-decoration |
underline | Specifies that a line will be displayed under the text |
overline | Specifies that a line will be displayed over the text |
line-through | Specifies that a line will be displayed through the text |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Chi tiết kỹ thuật
Giá trị mặc định: | không có |
---|---|
Giá trị trả về: | Một Chuỗi, biểu thị thuộc tính dòng trang trí văn bản của một phần tử |
Phiên bản CSS | CSS3 |
Trang liên quan
Tham khảo CSS: thuộc tính text-trang trí-line