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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
CSSPageRule
1
12
1
9
≤12.1
3
1
18
4
≤12.1
1
1.0
selectorText
1
12
No
9
≤12.1
3
1
18
No
≤12.1
1
1.0
style
1
12
12
9
≤12.1
3
1
18
14
≤12.1
1
1.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSSPageRule