CSS参考手册
网页媒体 | Paged Media
@page
该@page
@规则CSS用于打印document. 您不能改变所有的CSS属性时,修改一些CSS属性@page
。您只能更改文档的margins, orphans, widows 和分页符。试图改变任何其他的CSS属性将被忽略。
@page {
margin: 1cm;
}
@page :first {
margin: 2cm;
}
该@page
@规则可以通过CSS对象模型的接口来访问CSSPageRule
。
注: W3C正在讨论如何处理视相关<length>
单位vh
,vw
,vmin
,和vmax
。同时不要@page
在规则中使用它们。
语法
描述符
size
指定页面框包含块的目标大小和方向。在一般情况下,一个页面框被渲染到一个页面页面上,它也指示目的地页面页面的大小。marks
在文档中添加作物和/或注册标记。bleed
指定页面呈现被剪辑的页面框之外的范围。
形式语法
@page <page-selector-list> {
<page-body>
}where
<page-selector-list> = [ <page-selector># ]?
<page-body> = <declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>
where
<page-selector> = <pseudo-page>+ | <ident> <pseudo-page>*
<page-margin-box> = <page-margin-box-type> {
<declaration-list>
}
where
<pseudo-page> = : [ left | right | first | blank ]
<page-margin-box-type> = @top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom
实例
请参阅伪类成@page
举个例子。
:blank
:first
:left
:right
:recto
:verso
规范
Specification |
Status |
Comment |
---|---|---|
CSS Logical Properties Level 1The definition of ':recto and :verso' in that specification. |
Editor's Draft |
Adds the :recto and :verso page selectors |
CSS Paged Media Module Level 3The definition of '@page' in that specification. |
Working Draft |
No change from CSS Level 2 (Revision 1), though more CSS at-rules can be used inside a @page. |
CSS Level 2 (Revision 1)The definition of '@page' in that specification. |
Recommendation |
Initial definition |
浏览器兼容性
Feature |
Chrome |
Edge |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari |
---|---|---|---|---|---|---|
Basic support |
2.0 |
(Yes) |
19.0 (19.0) |
8.0 |
6.0 |
No support |
Feature |
Android |
Edge |
Firefox Mobile (Gecko) |
IE Mobile |
Opera Mobile |
Safari Mobile |
---|---|---|---|---|---|---|
Basic support |
? |
(Yes) |
19.0 (19.0) |
? |
? |
? |
网页媒体 | Paged Media相关
层叠样式表( Cascading Style Sheets )是一种用来表现 HTML 或 XML 等文件样式的计算机语言。CSS 不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。