-
Notifications
You must be signed in to change notification settings - Fork 22.7k
/
Copy pathindex.md
54 lines (38 loc) · 1.5 KB
/
index.md
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
47
48
49
50
51
52
53
54
---
title: CSSPropertyRule
slug: Web/API/CSSPropertyRule
page-type: web-api-interface
browser-compat: api.CSSPropertyRule
---
{{APIRef("CSS Properties and Values API")}}
The **`CSSPropertyRule`** interface of the [CSS Properties and Values API](/en-US/docs/Web/API/CSS_Properties_and_Values_API) represents a single CSS {{cssxref("@property")}} rule.
{{InheritanceDiagram}}
## Instance properties
_Inherits properties from its ancestor {{domxref("CSSRule")}}._
- {{domxref("CSSPropertyRule.inherits")}} {{ReadOnlyInline}}
- : Returns the inherit flag of the custom property.
- {{domxref("CSSPropertyRule.initialValue")}} {{ReadOnlyInline}}
- : Returns the initial value of the custom property.
- {{domxref("CSSPropertyRule.name")}} {{ReadOnlyInline}}
- : Returns the name of the custom property.
- {{domxref("CSSPropertyRule.syntax")}} {{ReadOnlyInline}}
- : Returns the literal syntax of the custom property.
## Instance methods
_No specific methods; inherits methods from its ancestor {{domxref("CSSRule")}}._
## Examples
This stylesheet contains a single {{cssxref("@property")}} rule. The first {{domxref("CSSRule")}} returned will be a `CSSPropertyRule` with the properties and values as defined by the rule in CSS.
```css
@property --property-name {
syntax: "<color>";
inherits: false;
initial-value: #c0ffee;
}
```
```js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0]); // A CSSPropertyRule
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}