Kiểu văn bản
Thí dụ
Hiển thị một phần tử với một dòng xuyên qua văn bản:
document.getElementById("demo").style.textDecorationLine = "line-through";
Định nghĩa và Cách sử dụng
Thuộc tính textDecorationLine đặt hoặc trả về kiểu dòng, nếu có, 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à một thuộc tính ngắn gọn 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ị, như gạch dưới và gạch ngang để hiển thị các dòng cả dưới và trên văn bản.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
textDecorationLine | 57.0 | 79.0 | 36.0 6.0 Moz |
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 ai |
---|---|
Giá trị trả lại: | Một chuỗi, đại diện cho 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 |
Các trang liên quan
Tham chiếu CSS: thuộc tính text-decoration-line
❮ Đối tượng phong cách