CSS Reference Pseudo-class

:right 1aw4g

:right is a CSS pseudo-class selector used to select all the right pages of a printed document. 1z5p60

When printing double-sided documents (such as books), the pages on left and right pages may be different. The :right page selector is used in conjunction with the @page, :right acts kind of like a filter used to select only the right pages.

@page :right {
    /* styles for the right pages */
}
                

In addition to :right, a :left, which select the first page and all the left pages in double-sided documents, respectively.

Styles specified in a :right @page rule that has no pseudo-class specified.

Styles specified in a @page rules.

It is important to note that you cannot change all CSS properties inside an @rule. See the @page entry for more information on what styles can be changed and/or applied.

All pages are automatically classified by agents into either the 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 :first applies to the blank page before the break or to the page after it.

If different declarations have been given for left and right pages, the agent must honor these declarations even if the agent does not transfer the pages to left and right sheets (e.g., a printer that only prints single-sided).

Official Syntax 55184y

The :right pseudo-class selector is used in conjunction with the @page rule like so:

@page :right {
    /* styles for the right pages go here... */
}
                

Examples 3e5p5z

/* All margins set to 2cm */
@page { 
    margin: 2cm; 
} 

/* Left margin on right pages 2.5cm */
@page :right {
  margin-right: 2.5;    
}
                

Browser k5t66

The :right pseudo-class selector is ed in Internet Explorer 8+ and in Opera 9.2+. It is not ed in Firefox. in other browsers is to be determined.

Written by

Last updated June 3, 2020 at 12:33 pm by Mary Lou

Do you have a suggestion, question or want to contribute? Submit an issue.