此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

CSSCounterStyleRule:pad 属性

Baseline Widely available

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

CSSCounterStyleRule 接口的 pad 属性用于获取或设置 pad 描述符的值。如果描述符没有设置值,此属性返回空字符串。

字符串。

示例

以下示例展示了 @counter-style 样式的规则。在 JavaScript 中,myRules[0]@counter-style 规则,pad 返回值为“0”。

css
@counter-style box-corner {
  system: numeric;
  symbols: "0" "1" "2" "3" "4" "5";
  pad: 2 "0";
}
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].pad); // "0"

规范

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

浏览器兼容性