MDN self-hosted library · e01.org

CSSPageRule: selectorText property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

css
@page {
  margin: 1cm;
}

@page :first {
  margin: 2cm;
}
js
const myRules = document.styleSheets[0].cssRules; // Two myRules
console.log(myRules[1].selectorText); // ":first"