CSSCounterStyleRule: prefix-Eigenschaft

Baseline 2023
Newly available

Since September 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Die prefix-Eigenschaft der CSSCounterStyleRule-Schnittstelle bekommt und setzt den Wert des prefix-Descriptors. Wenn der Deskriptor keinen Wert gesetzt hat, gibt dieses Attribut einen leeren String zurück.

Wert

Ein String.

Beispiele

Das folgende Beispiel zeigt eine @counter-style-Regel. In JavaScript ist myRules[0] diese @counter-style-Regel. Die Rückgabe von prefix gibt uns den Wert "Chapter " zurück.

css
@counter-style chapters {
  system: numeric;
  symbols: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9";
  prefix: "Chapter ";
}
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].prefix); // "Chapter "

Spezifikationen

Specification
CSS Counter Styles Level 3
# dom-csscounterstylerule-prefix

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
prefix

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support