:right

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

:right CSS 伪类必须与@规则 @page 一起配套使用,表示打印文档的所有右页。

css
/* 当打印时会选择所有文档右页 */
@page :right {
  margin: 2in 3in;
}

这里的“左”或“右”不是固定的,取决与文档的写作方向。如果第一页主要文字方向是从左到右的,那么它就是:right右页,反之它就是:left左页。

备注: 可通过 bdo 标签 的 dir 属性改变文字方向。

备注: 此伪类只能用于更改页面的 margin, padding, border, and background 属性。其他属性都将被忽略,只会影响页框,不会影响文档内容。

语法

css
:right {
  /* ... */
}

示例

css
@page :right {
  margin: 2in 3in;
}

规范

Specification
CSS Paged Media Module Level 3
# left-right-first

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Right-hand page pseudo-class (:right)

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

参见