CSS @page rule
- Previous Page padding-top
- Next Page page-break-after
Definition and Usage
CSS @page
The rule is used to customize the size, orientation, and margin of the print page.
Example
Custom Print Page:
@page :first { margin-left: 40%; margin-top: 50%; } @page :left { margin-left: 10%; margin-top: 10%; } @page :right { margin-left: 90%; margin-top: 90%; }
CSS Syntax
@page { margin: value; page-orientation: value; size: value; }
Attribute Value
Value | Description |
---|---|
margin | Specify the page margin. |
page-orientation | Specify the page orientation. |
size | Specify the target size and direction of the page box containing block. |
Browser Support
The numbers in the table represent the first browser version to fully support the @ rule.
At-rule | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
@page | 2 | 12 | 19 | No | 6 |
@page: size | 15 | 79 | 95 | No | 15 |
@page: page-orientation | 85 | 85 | No | No | 71 |
@page: @top-left | 131 | Not Supported | Not Supported | Not Supported | Not Supported |
@page: @left-top | 131 | Not Supported | Not Supported | Not Supported | Not Supported |
@page: @top-right | 131 | Not Supported | Not Supported | Not Supported | Not Supported |
@page: @right-top | 131 | Not Supported | Not Supported | Not Supported | Not Supported |
@page: @top-center | 131 | Not Supported | Not Supported | Not Supported | Not Supported |
@page: @bottom-left | 131 | Not Supported | Not Supported | Not Supported | Not Supported |
@page: @left-bottom | 131 | Not Supported | Not Supported | Not Supported | Not Supported |
- Previous Page padding-top
- Next Page page-break-after