CSS :first pseudo-class

Definition and usage

CSS :first Pseudo-classes are used to select and set the style of the first page of the printed document.

Tip::first Pseudo-classes can be used with @page rules.

Note:The following properties can be used with :first Used together:

  • Margin properties
  • orphans
  • widows
  • Pagination properties

Example

Select the first page to print:

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

Try it yourself

CSS syntax

@page :first {
  css declarations;
}

Technical details

Version: CSS3

Browser support

The numbers in the table specify the first browser version that fully supports this pseudo-class.

Chrome Edge Firefox Safari Opera
18 12 116 6 9.2

Related pages

Referência:CSS :left pseudo-class

Referência:Pseudo-classes CSS :right