size CSS at-rule descriptor

Baseline 2024
Newly available

Since December 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

The 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.

Syntax

css
/* 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;

Values

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>

Any length value (see <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>

A keyword which may be any of the following values:

A5

This matches the standard, ISO dimensions: 148mm x 210mm.

A4

This matches the standard, ISO dimensions: 210mm x 297mm. (most frequently used dimensions for personal printing.)

A3

This matches the standard, ISO dimensions: 297mm x 420mm.

B5

This matches the standard, ISO dimensions: 176mm x 250mm.

B4

This matches the standard, ISO dimensions: 250mm x 353mm.

JIS-B5

This correspond to the JIS standard dimensions: 182mm x 257mm.

JIS-B4

This correspond to the JIS standard dimensions: 257mm x 364mm.

letter

This keyword is an equivalent to the dimensions of letter paper in North America i.e., 8.5in x 11in.

This keyword is an equivalent to the dimensions of legal papers in North America i.e., 8.5in x 14in.

ledger

This keyword is an equivalent to the dimensions of ledger pages in North America i.e., 11in x 17in.

Formal definition

Related at-rule@page
Initial valueauto
Computed valueas specified, but with relative lengths converted into absolute lengths

Formal syntax

size = 
<length [0,∞]>{1,2} |
auto |
[ <page-size> || [ portrait | landscape ] ]

<page-size> =
A5 |
A4 |
A3 |
B5 |
B4 |
JIS-B5 |
JIS-B4 |
letter |
legal |
ledger

Examples

Specifying size and orientation

css
@page {
  size: A4 landscape;
}

Specifying a custom size

css
@page {
  size: 4in 6in;
}

Nesting inside a @media rule

css
@media print {
  @page {
    size: 50mm 150mm;
  }
}

Specifications

Specification
CSS Paged Media Module Level 3
# page-size-prop

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
size descriptor
Chrome – Full support
Chrome 15 (Release date: 2011-10-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 95 (Release date: 2021-12-07)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 18.2 (Release date: 2024-12-11)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 95 (Release date: 2021-12-07)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.2 (Release date: 2024-12-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1.5 (Release date: 2013-09-25)
footnote Full support
WebView Android – Full support
WebView Android 37 (Release date: 2014-09-03)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.2 (Release date: 2024-12-11)
footnote Full support
jis-b4 page size
Chrome – Full support
Chrome 83 (Release date: 2020-05-19)
footnote Full support
Edge – Full support
Edge 83 (Release date: 2020-05-21)
footnote Full support
Firefox – Full support
Firefox 95 (Release date: 2021-12-07)
footnote Full support
Opera – Full support
Opera 69 (Release date: 2020-06-24)
footnote Full support
Safari – Full support
Safari 18.2 (Release date: 2024-12-11)
footnote Full support
Chrome Android – Full support
Chrome Android 83 (Release date: 2020-05-19)
footnote Full support
Firefox for Android – Full support
Firefox for Android 95 (Release date: 2021-12-07)
footnote Full support
Opera Android – Full support
Opera Android 59 (Release date: 2020-06-30)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.2 (Release date: 2024-12-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 13 (Release date: 2020-12-02)
footnote Full support
WebView Android – Full support
WebView Android 83 (Release date: 2020-05-19)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.2 (Release date: 2024-12-11)
footnote Full support
jis-b5 page size
Chrome – Full support
Chrome 83 (Release date: 2020-05-19)
footnote Full support
Edge – Full support
Edge 83 (Release date: 2020-05-21)
footnote Full support
Firefox – Full support
Firefox 95 (Release date: 2021-12-07)
footnote Full support
Opera – Full support
Opera 69 (Release date: 2020-06-24)
footnote Full support
Safari – Full support
Safari 18.2 (Release date: 2024-12-11)
footnote Full support
Chrome Android – Full support
Chrome Android 83 (Release date: 2020-05-19)
footnote Full support
Firefox for Android – Full support
Firefox for Android 95 (Release date: 2021-12-07)
footnote Full support
Opera Android – Full support
Opera Android 59 (Release date: 2020-06-30)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.2 (Release date: 2024-12-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 13 (Release date: 2020-12-02)
footnote Full support
WebView Android – Full support
WebView Android 83 (Release date: 2020-05-19)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.2 (Release date: 2024-12-11)
footnote Full support

Legend

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

Full support
Full support