Thuộc tính màu nhấn CSS
Ví dụ
Đặt màu nhấn cho các điều khiển giao diện người dùng khác nhau:
input[type=checkbox] {
accent-color: red;
}
input[type=radio] {
accent-color: green;
}
input[type=range] {
accent-color:
rgb(0, 0, 255);
}
progress {
accent-color: hsl(39, 100%, 50%);
}
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính accent-color
chỉ định màu nhấn cho các điều khiển giao diện người dùng như: <input type="checkbox">, <input type="radio">, <input type="range"> và <progress>.
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: | CSS4 |
Cú pháp JavaScript: | đối tượng .style.accentColor="red" Hãy thử 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 | |||||
---|---|---|---|---|---|
accent-color | 93.0 | 93.0 | 92.0 | 15.4 | 79.0 |
Cú pháp CSS
accent-color:
auto| color |initial|inherit;
Giá trị tài sản
Value | Description | Demo |
---|---|---|
auto | Default value. The browser choose the accent color | Demo ❯ |
color | Specifies the color to be used as the accent color. All legal color values can be used (rgb, hex, named-color, etc). For more information on legal values, read our CSS Colors Tutorial | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |