CSSCounterStyleRule: prefix 屬性
CSSCounterStyleRule 介面的 prefix 屬性用於獲取和設定 prefix 描述符的值。如果該描述符未設定值,則此屬性返回一個空字串。
值
字串。
示例
以下示例展示了一個 @counter-style 規則。在 JavaScript 中,myRules[0] 就是這個 @counter-style 規則,獲取 prefix 會得到值 "Chapter "。
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 "
規範
| 規範 |
|---|
| CSS Counter Styles Level 3 # dom-csscounterstylerule-prefix |
瀏覽器相容性
載入中…