CSS @page Rule
The @page rule is poorly supported.
Example
@page {
margin: 50px;
}
@page :left {
margin: 1px;
}
@page :right {
margin: 3px;
}
@page :first {
margin-top: 5px;
}
Meaning
The @page at-rule is used to modify some CSS properties when printing a document.
Generally, within this construct we see various CSS properties like size, page, and margin to control the dimensions of the page.
Note: This construct is not well supported, even in modern browsers.
Standard Syntax
@page [:left | :right | :first] {
/* print-specific rules */
}
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
:left | The :left CSS pseudo-class, used with the @page at-rule, represents all left-hand pages of a printed document. |
:right | The :right CSS pseudo-class, used with the @page at-rule, represents all right-hand pages of a printed document. |
:first | The :first CSS pseudo-class, used with the @page at-rule, represents the first page of a printed document. |
page-orientation | Specifies the orientation of the document on the page, allowing it to be laid out and formatted as normal or be rotated to one either left or right side. |
size | Specifies the target size and orientation of the page box's containing block. |