Thuộc tính màu thanh cuộn CSS
Ví dụ
Đặt màu thanh cuộn của một phần tử:
div.scroller {
width: 300px;
height: 100px;
overflow-y: scroll;
scrollbar-color: pink lightblue;
}
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính scrollbar-color
chỉ định màu của rãnh thanh cuộn (nền) và ngón tay cái (con cuộn).
Giá trị mặc định: | tự động |
---|---|
Thừa hưởng: | Đúng |
Hoạt hình: | KHÔNG. Đọc về hoạt hình |
Phiên bản: | Mô-đun tạo kiểu thanh cuộn CSS cấp 1 |
Cú pháp JavaScript: | object .style.scrollbarColor="red blue" Hãy dùng thử |
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 | |||||
---|---|---|---|---|---|
scrollbar-color | Not supported | Not supported | 64.0 | Not supported | Not supported |
Cú pháp CSS
scrollbar-color: auto| color color ;
Giá trị tài sản
Value | Description |
---|---|
auto | The browser sets the colors of the scrollbar. This is default |
color color | The first color sets the color of the thumb of the scrollbar, and the second color sets the color of the track of the scrollbar |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |