HTML and CSS Reference
In-Depth Information
You define a page box using the special @page at-rule. Immediately fol-
lowing the @page keyword is an optional name for the page, followed by a
list of properties separated by semicolons and enclosed in curly braces.
These properties define the size, margins, and appearance of the page
box.
Use the size property to specify the size of the page box. The value of
this property is either one or two length values, or one of the special
keywords portrait, landscape , or auto . If you provide a single length
value, it creates a square, setting both the width and the height of the
page to that value. Two length values set the width and the height of the
page, respectively. The portrait keyword specifies the locally accepted
page size that is taller than it is wide (typically 8 x 11), and landscape
uses a locally accepted page size that is wider than it is tall (typically 11
x 8 inches). Finally, auto creates a page box that is the same size as the
target sheet of paper on which the document is printed.
In general, you should use the special page size keywords to ensure that
your document prints well in the local environment. Using:
@page normal { size : 8.5in 11in }
works fine in the U.S. but may fail in European locales. Instead, use:
@page normal { size : portrait }
which should select an 8.5" x 11" page in the U.S. and an A4 sheet in
Europe. [*]
[*] The word normal in the rule is the page name, of course.
Use the margin, margin-top, margin-bottom, margin-left , and margin-
right properties within the @page at-rule to set margins for your page.
Keep in mind that the browser may define margins for rendering the
page box within the target sheet, so your margins are in addition to
 
 
Search WWH ::




Custom Search