这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
size
CSS
at-rule
descriptor, used with the
@page
at-rule, defines the size and orientation of the box which is used to represent a page. Most of the time, this size corresponds to the target size of the printed page if applicable.
Size may either be defined with a "scalable" keyword (in this case the page will fill the available dimensions) or with absolute dimensions.
/* Keyword values for scalable size */ size: auto; size: portrait; size: landscape; /* <length> values */ /* 1 value: height = width */ size: 6in; /* 2 values: width then height */ size: 4in 6in; /* Keyword values for absolute size */ size: A4; size: B5; size: JIS-B4; size: letter; /* Mixing size and orientation */ size: A4 portrait;
auto
The user agent decides the size of the page. In most cases, the dimensions and orientation of the target sheet are used.
landscape
The content of the page is displayed in landscape mode (i.e. the longest side of the box is horizontal).
portrait
The content of the page is displayed in portrait mode (i.e. the longest side of the box is vertical). This is the default orientation.
<length>
<length>
). The first value corresponds to the width of the page box and the second one corresponds to its height. If only one value is provided, it is used for both width and height.
<page-size>
This matches the standard, ISO dimensions: 148mm x 210mm.
This matches the standard, ISO dimensions: 210mm x 297mm. (most frequently used dimensions for personal printing.)
This matches the standard, ISO dimensions: 297mm x 420mm.
This matches the standard, ISO dimensions: 176mm x 250mm.
This matches the standard, ISO dimensions: 250mm x 353mm.
This correspond to the JIS standard dimensions: 182mm x 257mm.
This correspond to the JIS standard dimensions: 257mm x 364mm.
This keyword is a equivalent to the dimensions of letter paper in North America i.e. 8.5in x 11in.
This keyword is a equivalent to the dimensions of legal papers in North America i.e. 8.5in x 14in.
This keyword is a equivalent to the dimensions of ledger pages in North America i.e. 11in x 17in.
| 相关 at-rule |
@page
|
|---|---|
| 初始值 |
auto
|
| 计算值 | as specified, but with relative lengths converted into absolute lengths |
<length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]
@page {
size: 4in 6in landscape;
}
@media print {
@page {
size: 50mm 150mm;
}
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Paged Media Module Level 3
The definition of 'size' in that specification. |
工作草案 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
size
descriptor
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
不支持