CSSPageRule

CSSPageRule represents a single CSS @page rule.

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 Status Comment
CSS Object Model (CSSOM)
The definition of 'CSSPageRule' in that specification.
Working Draft No changes from Document Object Model (DOM) Level 2 Style Specification
Document Object Model (DOM) Level 2 Style Specification
The definition of 'CSSPageRule' in that specification.
Obsolete Initial definition

Browser compatibility

BCD tables only load in the browser