This feature is not Baseline because it does not work in some of the most widely-used browsers.
The page-orientation CSS descriptor for the @page at-rule controls the rotation of a printed page. It handles the flow of content across pages when the orientation of a page is changed. This behavior differs from the size descriptor in that a user can define the direction in which to rotate the page.
This descriptor helps with the layout and orientation of printed documents, especially when documents are printed double-sided. A user can specify how the pages will be rotated when printed. This is particularly useful to lay out content such as tables, which may be wider than the rest of the content, in a different orientation.
Note: Margin boxes and other positional elements have no special interaction with this descriptor. Margins are laid out as normal in the unrotated page, then rotated along with everything else.
/* Displays the print content in an upright position */
@page {
page-orientation: upright;
}
/* Displays the print content rotated counter-clockwise */
@page {
page-orientation: rotate-left;
}
/* Displays the print content rotated clockwise */
@page {
page-orientation: rotate-right;
}
uprightNo orientation is applied and the page is laid out and formatted as normal.
rotate-leftAfter a page is laid out, the page must be displayed rotated a quarter turn to the left (counter-clockwise).
rotate-rightAfter the page is laid out, the page must be displayed rotated a quarter turn to the right (clockwise).
| Related at-rule | @page |
|---|---|
| Initial value | upright |
| Computed value | as specified |
page-orientation =
upright |
rotate-left |
rotate-right
This example shows how the contents of a print document can be rotated to suit the page content and the page position. In this first part of the CSS code, named pages are set up to define the direction in which to rotate the content.
@page upright {
size: portrait;
page-orientation: upright;
}
@page left {
size: landscape;
page-orientation: rotate-left;
}
@page right {
size: landscape;
page-orientation: rotate-right;
}
The second part of the CSS code declares a named page rule defined above for the selectors, such as <section class="left">…</section>.
@media print {
.upright {
page: upright;
}
.left {
page: left;
}
.right {
page: right;
}
}
Click the print button to see the page orientation on print.
| Specification |
|---|
| CSS Paged Media Module Level 3> # page-orientation-prop> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
page-orientation |
85 | 85 | 122 | 71 | No | 85 | 122 | 60 | No | 14.0 | 85 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/@page/page-orientation