CSSPageRule represents a single CSS @page rule.
CSSPageRule represents a single CSS @page rule.
Inherits properties from its ancestor CSSRule.
CSSPageRule.selectorTextRepresents the text of the page selector associated with the at-rule.
CSSPageRule.style Read only
Returns the declaration block associated with the at-rule.
Inherits methods from its ancestor CSSRule.
The stylesheet includes a single @page rule, therefore the first (and only) rule returned will be a CSSPageRule.
css
@page { margin: 1cm; }
js
let myRules = document.styleSheets[0].cssRules; console.log(myRules[0]); // a CSSPageRule
| Specification |
|---|
| CSS Object Model (CSSOM) # the-csspagerule-interface |
| 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 | 19 | 9 | ≤12.1 | 3 | 4.4 | 18 | 19 | ≤12.1 | 1 | 1.0 |
selectorText |
1 | 12 | 110 | 9 | ≤12.1 | 3 | 4.4 | 18 | 110 | ≤12.1 | 1 | 1.0 |
style |
1 | 12 | 19 | 9 | ≤12.1 | 3 | 4.4 | 18 | 19 | ≤12.1 | 1 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSSPageRule