:right Back
:rightis a CSS pseudo-class selector used to select all the right pages of a printed document.- When printing double-sided documents (such as books), the pages on left and right pages may be different. The
:rightpage selector is used in conjunction with the@pagerule, which selects all pages in a printed document, to select all the right pages of the document. In other words, when used with@page,:rightacts kind of like a filter used to select only the right pages.
@page :right {
/* styles for the right pages */
}
Note
- In addition to :right, a
@pagecan be used in conjunction with two other pseudo-classes, namely:firstand:left, which select the first page and all the left pages in double-sided documents, respectively. - Styles specified in a
:right@pagerule override any styles provided in an@pagerule that has no pseudo-class specified. - Styles specified in a
:first@pagerule override any styles specified in:leftand:right@pagerules. - According to rules
@page, you can only change some CSS properties:
| categories | items |
|---|---|
| Margin Properties | margin-top, margin-left, margin-right, and margin-bottom |
| Page Break Properties | page-break-after, page-break-before, and page-break-inside |
| Other Properties | orphans and windows |
- All pages are automatically classified by user agents into either the
:leftor:rightpseudo-class. Whether the first page of a document is:leftor:rightdepends on the major writing direction of the root element. For example, the first page of a document with a left-to-right major writing direction would be a:rightpage, and the first page of a document with a right-to-left major writing direction would be a:leftpage. To explicitly force a document to begin printing on a left or right page, authors can insert a page break before the first generated box. - If a forced break occurs before the first generated box, it is undefined in CSS 2.1 whether
:firstapplies to the blank page before the break or to the page after it.
