CSS @page Rule
Example
Customize printed pages:
@page :first {
margin-left: 40%;
margin-top: 50%;
}
@page :left {
margin-left: 10%;
margin-top: 10%;
}
@page :right {
margin-left: 90%;
margin-top: 90%;
}
Try it Yourself »
Definition and Usage
The CSS @page
rule is used to
customize the dimension, orientation, and margins of printed pages.
Browser Support
The numbers in the table specify the first browser version that fully supports the at-rule.
At-rule | |||||
---|---|---|---|---|---|
@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 | No | No | No | No |
@page: @left-top | 131 | No | No | No | No |
@page: @top-right | 131 | No | No | No | No |
@page: @right-top | 131 | No | No | No | No |
@page: @top-center | 131 | No | No | No | No |
@page: @bottom-left | 131 | No | No | No | No |
@page: @left-bottom | 131 | No | No | No | No |
CSS Syntax
@page {
margin: value;
page-orientation: value;
size: value;
}
Property Values
Value | Description |
---|---|
margin | Specifies the page margins |
page-orientation | Specifies the orientation of the page |
size | Specifies the target size and orientation of the page box's containing block |