coderef

Page setupBaseline · Newly available

The @page CSS at-rule sets the page-specific dimensions and margins for content such as printed documents, ebooks, or slides.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Dec 11, 2024.

Browser support

DesktopChrome
1–14Not supported
15+Supportedsince Oct 25, 2011
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–94Not supported
95+Supportedsince Dec 7, 2021
Current: 157
Safari
1–18.1Not supported
18.2+Supportedsince Dec 11, 2024
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
4–94Not supported
95+Supportedsince Dec 7, 2021
Current: 157
Safari iOS
1–18.1Not supported
18.2+Supportedsince Dec 11, 2024
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Dec 11, 2024. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN: @page.

Feature detection

CSS · check before using
@supports (page: initial) {
  /* styles that rely on page */
}

/* or in JavaScript */
if (CSS.supports("page", "initial")) {
  // use it
}

Sub-features

Support for each part of the feature (21). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
@page2121918.2181918.2
@page.at_bottom-center131131✕✕131✕✕
@page.at_bottom-left131131✕✕131✕✕
@page.at_bottom-left-corner131131✕✕131✕✕
@page.at_bottom-right131131✕✕131✕✕
@page.at_bottom-right-corner131131✕✕131✕✕
@page.at_left-bottom131131✕✕131✕✕
@page.at_left-middle131131✕✕131✕✕
@page.at_left-top131131✕✕131✕✕
@page.at_right-bottom131131✕✕131✕✕
@page.at_right-middle131131✕✕131✕✕
@page.at_right-top131131✕✕131✕✕
@page.at_top-center131131✕✕131✕✕
@page.at_top-left131131✕✕131✕✕
@page.at_top-left-corner131131✕✕131✕✕
@page.at_top-right131131✕✕131✕✕
@page.at_top-right-corner131131✕✕131✕✕
@page.size15799518.2189518.2
@page.size.jis-b483839518.2839518.2
@page.size.jis-b583839518.2839518.2
Show 1 more
Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
page85851101851101