CSSCounterStyleRule: name

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2023.

Thuộc tính name của giao diện CSSCounterStyleRule lấy và thiết lập <custom-ident> được định nghĩa là name cho quy tắc tương ứng.

Giá trị

Một chuỗi.

Ví dụ

Ví dụ sau đây cho thấy một quy tắc @counter-style. Trong JavaScript, myRules[0] là quy tắc @counter-style này, khi trả về name sẽ cho ta định danh tùy chỉnh "box-corner".

css
@counter-style box-corner {
  system: fixed;
  symbols: ◰ ◳ ◲ ◱;
  suffix: ": ";
  fallback: disc;
}
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].name); // "box-corner"

Đặc tả kỹ thuật

Thông số kỹ thuật
CSS Counter Styles Level 3
# dom-csscounterstylerule-name

Tương thích trình duyệt