XML technologies / CSS / Advanced websites with CSS / CSS property reference / size

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The property size describes the size or format of the printed version of an HTML page. size is declared only in at-rules.

Values

One or two CSS measurements separated by spaces. A single value applies to both height and width of a printed page. With two values, the first specifies the height and the second the width. Alternatively, the following constants can define the page format:

  • auto

  • landscape

  • portrait

The constant auto tells the browser to use its default setting for printing a page. The constants landscape and portrait specify landscape and portrait printing respectively.

Default value: auto

Compatibility

CSS version: 2

Not supported by any current browser.

Example

The following rule specifies that a page is printed in landscape DIN A4 format (21 × 29.7 cm):

@page {
 size: 21cm 29.7cm;
}

  

 

 

 

back to top