Regola CSS @page

Definition and usage

CSS @page The rule is used to customize the size, orientation, and margin of the print page.

Example

Custom print page:

@page :first {
  margin-left: 40%;
  margin-top: 50%;
}
@page :left {
  margin-left: 10%;
  margin-top: 10%;
}
@page :right {
  margin-left: 90%;
  margin-top: 90%;
}

Try it yourself

CSS syntax

@page {
  margin: value;
  page-orientation: value;
  size: value;
}

Attribute value

Value Description
margin Specify the page margin.
page-orientation Specify the page orientation.
size Specify the target size and direction of the page box containing block.

Browser support

The numbers in the table represent the first browser version to fully support the @ rule.

At-rule Chrome Edge Firefox Safari Opera
@page 2 12 19 No 6
@page: size 15 79 95 No 15
@page: page-orientation 85 85 No No 71
@page: @top-left 131 Non supportato Non supportato Non supportato Non supportato
@page: @left-top 131 Non supportato Non supportato Non supportato Non supportato
@page: @top-right 131 Non supportato Non supportato Non supportato Non supportato
@page: @right-top 131 Non supportato Non supportato Non supportato Non supportato
@page: @top-center 131 Non supportato Non supportato Non supportato Non supportato
@page: @bottom-left 131 Non supportato Non supportato Non supportato Non supportato
@page: @left-bottom 131 Non supportato Non supportato Non supportato Non supportato