Đường viền kiểu dáng
Thí dụ
Thay đổi màu của đường viền của phần tử <div>:
document.getElementById("myDiv").style.outlineColor = "#00ff00";
Định nghĩa và Cách sử dụng
Thuộc tính outlineColor đặt hoặc trả về màu của đường viền xung quanh một phần tử.
Đường viền là một đường bao quanh một phần tử. Nó được hiển thị xung quanh lề của phần tử. Tuy nhiên, nó khác với tài sản biên giới.
Đường viền không phải là một phần của kích thước của phần tử, do đó thuộc tính chiều rộng và chiều cao của phần tử không chứa chiều rộng của đường viền.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
outlineColor | Yes | Yes | Yes | Yes | Yes |
Cú pháp
Trả về thuộc tính outlineColor:
object.style.outlineColor
Đặt thuộc tính outlineColor:
object.style.outlineColor = "color|invert|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
color | Specifies the color of the outline. Look at CSS Color Values for a complete list of possible color values |
invert | Inverts the color of the outline to the opposite value. Note: Browsers are not required to support this value |
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: | đảo ngược |
---|---|
Giá trị trả lại: | Một chuỗi, đại diện cho màu của đường viền của một phần tử |
Phiên bản CSS | CSS2 |
Các ví dụ khác
Thí dụ
Trả lại màu viền của phần tử <div>:
alert(document.getElementById("myDiv").style.outlineColor);
Các trang liên quan
Hướng dẫn CSS: CSS Outline
Tham chiếu CSS: thuộc tính outline-color
Tham chiếu DOM HTML: thuộc tính phác thảo
❮ Đối tượng phong cách