HTML and CSS Reference
In-Depth Information
To otherwise force or suppress page breaks, use the page-break-before,
page-break-after , and page-break-inside properties.
Both the page-break-before and page-break-after properties accept the
auto, always, avoid, left , and right keywords. auto is the default; it
lets the browser generate page breaks as needed. The keyword always
forces a page break before or after the element, and avoid suppresses a
page break immediately before or after the element. The left and right
keywords force one or two page breaks so that the element is rendered
on a lefthand or righthand page.
Using pagination properties is straightforward. Suppose your document
has level-1 headers start new chapters, with sections denoted by level-2
headers. You'd like each chapter to start on a new, righthand page, but
you don't want section headers to be split across a page break from the
subsequent content. Accordingly, you might write your CSS2 print rule
as follows:
h1 { page-break-before : right }
h2 { page-break-after : avoid }
Use only the auto and avoid values with the page-break-inside property.
auto allows page breaks within the element (the default behavior), and
avoid suppresses them. Even so, elements that are larger than the prin-
ted page get broken up; that is why the keyword is avoid and not pre-
vent .
If you prefer that your tables not be broken across pages if possible,
you would write the following rule:
table { page-break-inside : avoid }
 
Search WWH ::




Custom Search