值
整型。
示例
以下示例将名为 myRules 的 CSSRuleList 中的项目数量打印到控制台。
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules.length);
规范
| 规范 |
|---|
| CSS Object Model (CSSOM)> # dom-cssrulelist-length> |
此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
CSSRuleList 接口的 length 属性返回列表中 CSSRule 对象的数量。
整型。
以下示例将名为 myRules 的 CSSRuleList 中的项目数量打印到控制台。
let myRules = document.styleSheets[0].cssRules;
console.log(myRules.length);
| 规范 |
|---|
| CSS Object Model (CSSOM)> # dom-cssrulelist-length> |