docs.rodeo

MDN Web Docs mirror

size

{{CSSRef}} 

The size CSS at-rule descriptor, used with the {{cssxref("@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

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

Formal definition

{{cssinfo}} 

Formal syntax

{{csssyntax}} 

Examples

Specifying size and orientation

@page {
  size: A4 landscape;
}

Specifying a custom size

@page {
  size: 4in 6in;
}

Nesting inside a @media rule

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

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

In this article

View on MDN