CSSPageRule: style property

The style read-only property of the CSSPageRule interface returns a CSSStyleDeclaration object. This represents an object that is a CSS declaration block, and exposes style information and various style-related methods and properties.

Value

A CSSStyleDeclaration object, which represents a CSS declaration block with the following properties:

computed flag

Unset.

declarations

The declared declarations in the rule, in the order they were specified, shorthand properties expanded to longhands.

parent CSS rule

The context object, which is an alias for this.

owner node

Null.

Examples

The stylesheet includes a @page rule. Getting a list of rules, then returning the value of the style property will return a CSSStyleDeclaration object.

css

@page {
  margin: 1cm;
}

js

let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].style); // returns a CSSStyleDeclaration object

Specifications

Specification
CSS Object Model (CSSOM)
# dom-cssgroupingrule-style

Browser compatibility

BCD tables only load in the browser