CSSPageRule

CSSPageRule represents a single CSS @page rule.

CSSRule CSSGroupingRule CSSPageRule

Properties

Inherits properties from its ancestor CSSRule.

CSSPageRule.selectorText

Represents the text of the page selector associated with the at-rule.

CSSPageRule.style Read only

Returns the declaration block associated with the at-rule.

Methods

Inherits methods from its ancestor CSSRule.

Examples

The stylesheet includes a single @page rule, therefore the first (and only) rule returned will be a CSSPageRule.

@page {
  margin: 1cm;
}
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0]); // a CSSPageRule

Specifications

Specification
CSS Object Model (CSSOM)
# the-csspagerule-interface

Browser compatibility

BCD tables only load in the browser