:left

:left CSS 伪类, 需要和@规则  @page 配套使用, 对打印文档的左侧页设置CSS样式.

/* 设置打印时的左侧文档样式 */
@page :left {
  margin: 2in 3in;
}

打印文档的"左"或"右"是由书写方向相关的. 举个栗子, "从左到右"的书写方向中第一页应当使用 :right 配置; "从右至左"的书写方向中第一页应当使用 :left 配置.

Note: 并不是所有样式属性都能应用在此选择器内. 仅仅 margin, padding, border, 和 background 等打印时需要的属性可以使用. 其他属性将直接忽略, 并且可以使用的属性也只会在打印时生效, 显示时不会生效.

参数

:left

样例

@page :left {
  margin: 2in 3in;
} 

规范

Specification Status Comment
CSS Paged Media Module Level 3
:left
Working Draft No change.
CSS Level 2 (Revision 1)
:left
Recommendation Initial definition.

浏览器兼容性

 

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Left-hand page pseudo-class (:left)Chrome Full support 6Edge Full support 12Firefox No support NoIE Full support 8Opera Full support 9.2Safari Full support 5.1WebView Android Full support ≤37Chrome Android Full support 18Firefox Android No support NoOpera Android Full support 10.1Safari iOS Full support 6Samsung Internet Android Full support 1.0

Legend

Full support  
Full support
No support  
No support

 

参考