Page Style

Pages can be styled using the margin, border, padding and background properties within @page rules.

The page box contains margins, an optional border and padding. Within the border the page may have a painted background. The remaining space within the padding is used to render document content.


@page { margin: 40pt 30pt 40pt 30pt }

This sets the top, right, bottom and left page margins to 40pt, 30pt, 40pt and 30pt, respectively.


@page { border: solid 1pt red }

This sets the page border style to solid, page border width to 1pt and page border color to red.


@page { padding: 10pt 5pt }

This sets the top and bottom page padding to 10pt; right and left page padding to 5pt.


@page { 
    background: gray url(filename) center no-repeat 

This sets the page background color to gray, loads an image from filename and centers it on the page background without repeating.