CSSPageRule
CSSPageRule
represents a single CSS @page
rule.
Instance properties
Inherits properties from its ancestors CSSGroupingRule
and 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.
Instance methods
Inherits methods from its ancestors CSSGroupingRule
and CSSRule
.
Examples
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
Specifications
Specification |
---|
CSS Object Model (CSSOM) # the-csspagerule-interface |
Browser compatibility
BCD tables only load in the browser