HTML and CSS Reference
Setting Page Margins
Although it's not currently possible to set the size or orientation of the printed page, you can—and should—set
the page's margins. You do this with the @page rule.
The @page Rule
The @page rule accepts only the margin shorthand property or the individual margin properties. Moreover,
you cannot use em or ex units to specify the size of the margins. Use either percentages or the physical units of
measurement in Table 16-2 .
Table 16-2. Physical Units of Measurement for Print Styles
Inch (2.54 centimeters)
Centimeter (0.394 in)
Millimeter (0.039 in)
Point, a typographical unit equivalent to 1/72 of an inch (0.353 mm)
Pica, a typographical unit equivalent to 12 points (4.233 mm)
To add a one-inch margin all around a page (the same as a default document in Microsoft Word), put the
following rule at the top of your print styles:
The following does the same using metric measurements:
If you come from a print background, you might prefer this:
■ Technically speaking you can also use px , which is equivalent to 0.75pt (1/96 in or 0.265 mm).
However, the physical units in Table 16-2 are more common for print, especially fonts, which are measured in points.
If you specify the margins as percentages, the left and right margins are relative to the width of the page, and
top and bottom margins are relative to its height.