aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/cssrulelist/length/index.md
blob: 6847644d23a969e7750efaee5c5d8dc1a6ba359c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
title: CSSRuleList.length
slug: Web/API/CSSRuleList/length
tags:
  - API
  - プロパティ
  - リファレンス
  - length
  - CSSRuleList
browser-compat: api.CSSRuleList.length
translation_of: Web/API/CSSRuleList/length
---
{{ APIRef("CSSOM") }}

**`length`** は {{domxref("CSSRuleList")}} インターフェイスのプロパティで、リスト内の {{domxref("CSSRule")}} オブジェクトの数を返します。

## 構文

```js
let length = CSSRuleList.length;
```

### 値

整数です。

## 例

以下の例では、 `myRules` という名前の {{domxref("CSSRuleList")}} にあるアイテムの数をコンソールに出力します。

```js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules.length);
```

## 仕様書

{{Specifications}}

## ブラウザーの互換性

{{Compat}}