@page

@page styles the printed page box: size (A4, letter, 210mm 297mm, landscape), margin, and page-orientation (Chromium 4,389 and Firefox 555 ). The selectors :first, :left, :right and :blank target subsets, and named pages apply through the page property. Page setup became Baseline 2024 with Safari 18.2 10 . The 16 margin boxes (@top-center, @bottom-right...) for running headers and page numbers work only in Chrome 1 and Edge 131+ and are experimental.

Named pages and a page-number footer for printCSS
@page { size: A4; margin: 20mm 18mm; }
@page :first { margin-top: 40mm; }
@page wide { size: A4 landscape; }
.data-table { page: wide; }            /* starts a new landscape page */
@page {
  @bottom-center { content: "Page " counter(page) " of " counter(pages); }  /* Chromium only */
}

Browsers still ignore backgrounds, borders and fonts on the page box itself. Pair @page with the printer selectors of Printer Selectors; for books and invoices, Paged.js (open source) or Prince 627,195 (commercial) implement far more of the specification.