Thuộc tính trang trí văn bản
Ví dụ
Đặt trang trí văn bản cho một phần tử:
document.getElementById("demo").style.textDecoration = "underline overline";
Hãy tự mình thử »Sự miêu tả
Thuộc tính textDecoration đặt hoặc trả về một hoặc nhiều kiểu trang trí hơn cho văn bản.
Mẹo: Để chỉ định nhiều kiểu trang trí cho một phần tử, hãy chỉ định danh sách các kiểu trang trí được phân tách bằng dấu cách.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
textDecoration | Yes | Yes | Yes | Yes | Yes |
Cú pháp
Trả về thuộc tính textDecoration:
object .style.textDecoration
Đặt thuộc tính textDecoration:
object .style.textDecoration = "none|underline|overline|line-through|blink|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
none | Defines a normal text. This is default |
underline | Defines a line under the text |
overline | Defines a line over the text |
line-through | Defines a line 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, thể hiện phần trang trí được thêm vào văn bản |
Phiên bản CSS | CSS1 |
Thêm ví dụ
Ví dụ
Trả về trang trí văn bản của một phần tử:
alert(document.getElementById("demo").style.textDecoration);
Hãy tự mình thử »Trang liên quan
Hướng dẫn CSS: Văn bản CSS
Tham chiếu CSS: thuộc tính trang trí văn bản