Edit online

Setting Page Margins

The same margin model applies to the page as for any element. The content is surrounded by padding, then a border, then margins. The page margins are between the physical end of the page and the text (if no border or padding is defined).

For example, to create a default page with margins of two inches:

@page {
  margin: 2in;
} 

Or you can specify them for all the sides:

@page {
  margin-left: 2in;
  margin-right: 1in;
  margin-top: 0.5in;
}

Or you may want the inner margins of the pages of a book to be larger:

@page {
  margin: 0.5in;
}

@page :left {
  margin-right: 1in;
}

@page :right {
  margin-left: 1in;
}

If no margins are specified in the CSS, the page margins are set at 1in.