aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/cssrulelist/item/index.md
blob: 26a448e1fc1ed43850237b573c65c141c15a06d9 (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
43
44
45
46
---
title: CSSRuleList.item()
slug: Web/API/CSSRuleList/item
tags:
  - API
  - メソッド
  - リファレンス
  - item
  - CSSRuleList
browser-compat: api.CSSRuleList.item
---
{{ APIRef("CSSOM") }}

**`item()`** は {{domxref("CSSRuleList")}} インターフェイスのメソッドで、 `index` で指定された {{domxref("CSSRule")}} オブジェクトを返します。指定された `index` が存在しなければ `null` を返します。

## 構文

```js
CSSRuleList.item(index);
```

### 引数

- `index`
  - : 整数です。

### 返値

{{domxref("CSSRule")}} です。

## 例

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

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

## 仕様書

{{Specifications}}

## ブラウザーの互換性

{{Compat}}