Thuộc tính kiểu phác thảo CSS
Thêm ví dụ "Hãy tự mình thử" bên dưới.
Định nghĩa và cách sử dụng
Đường viền là một đường được vẽ xung quanh các phần tử, bên ngoài đường viền, để làm cho phần tử "nổi bật".
Thuộc tính outline-style
chỉ định kiểu của đường viền.
Giá trị mặc định: | không có |
---|---|
Thừa hưởng: | KHÔNG |
Hoạt hình: | KHÔNG. Đọc về hoạt hình |
Phiên bản: | CSS2 |
Cú pháp JavaScript: | object .style.outlineStyle="dashed" Hãy thử nó |
Lời khuyên và ghi chú
Lưu ý: Đường viền khác với đường viền ! Không giống như đường viền, đường viền được vẽ bên ngoài đường viền của phần tử và có thể chồng lên nội dung khác. Ngoài ra, đường viền KHÔNG phải là một phần kích thước của phần tử; tổng chiều rộng và chiều cao của phần tử không bị ảnh hưởng bởi chiều rộng của đường viền.
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Property | |||||
---|---|---|---|---|---|
outline-style | 1.0 | 8.0 | 1.5 | 1.2 | 7.0 |
Cú pháp CSS
outline-style: none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|initial|inherit;
Giá trị tài sản
Value | Description | Demo |
---|---|---|
none | Specifies no outline. This is default | Demo ❯ |
hidden | Specifies a hidden outline | Demo ❯ |
dotted | Specifies a dotted outline | Demo ❯ |
dashed | Specifies a dashed outline | Demo ❯ |
solid | Specifies a solid outline | Demo ❯ |
double | Specifies a double outliner | Demo ❯ |
groove | Specifies a 3D grooved outline. The effect depends on the outline-color value | Demo ❯ |
ridge | Specifies a 3D ridged outline. The effect depends on the outline-color value | Demo ❯ |
inset | Specifies a 3D inset outline. The effect depends on the outline-color value | Demo ❯ |
outset | Specifies a 3D outset outline. The effect depends on the outline-color value | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Thêm ví dụ
Ví dụ
Một phác thảo rãnh:
div {
outline-style:
groove;
outline-color: coral;
outline-width: 7px;
}
Hãy tự mình thử »Ví dụ
Một phác thảo sườn núi:
div {
outline-style:
ridge;
outline-color: coral;
outline-width: 7px;
}
Hãy tự mình thử »Ví dụ
Một phác thảo nội dung:
div {
outline-style:
inset;
outline-color: coral;
outline-width: 7px;
}
Hãy tự mình thử »Ví dụ
Một phác thảo ban đầu:
div {
outline-style:
outset;
outline-color: coral;
outline-width: 7px;
}
Hãy tự mình thử »Ví dụ
Đặt kiểu đường viền bằng các giá trị khác nhau:
p.a {outline-style: dotted;}
p.b {outline-style: dashed;}
p.c {outline-style: solid;}
p.d {outline-style: double;}
p.e {outline-style: groove;}
p.f {outline-style: ridge;}
p.g {outline-style: inset;}
p.h {outline-style: outset;}
Hãy tự mình thử »Trang liên quan
Hướng dẫn CSS: CSS Outline
Tham chiếu CSS: thuộc tính phác thảo
Tham chiếu DOM HTML: thuộc tính OutlineStyle