@page CSS At-Rule

Description

The @page CSS at-rule allows you to set the value of fields when printing a document or for pages whose media type is set to print. You can only change the margins, orphans, widows, and page breaks of the document. Attempts to change any other CSS properties will be ignored.

Syntax

@page :pseudo-selector {
    /* margins, widows, orphans, and/or page break styles */
}

Values

  • sizeSpecifies the target size and orientation of the page box’s containing block. In the general case, where one page box is rendered onto one page sheet, it also indicates the size of the destination page sheet.
  • marksAdds crop and/or registration marks to the document.
  • bleedSpecifies the extent beyond the page box at which the page rendering is clipped.

Example

@page: left {
margin-left: 4cm;
margin-right: 2cm;
}
@page: right {
margin-left: 2cm;
margin-right: 4cm;
}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
8122196X
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
371819XXX