To control paging, use page-break-before, page-break-after and page- break- Inside the attribute.
page-break-before and page-break-after both accept auto, always, and avoid the left and right keywords. The
keyword auto is the default; it allows the browser to generate page breaks as needed. The keyword always forces pagination before or after an element, while avoid prohibits pagination immediately before or after an element. Left and Right keyword forces one or two page breaks so that elements are rendered on the left or right side of the page.
Using the pagination attribute is very simple. Let's say your document has level 1 headings, and you represent chapters by starting new sections with level 2 headings. You want each chapter to start on a new right-hand page, but you don't want a page break to separate the chapter title from the content that follows.
You can achieve this using the following rules
<style> <!-- h1 { page-break-before : right } h2 { page-break-after : avoid } --> </style>
The above is the detailed content of Control pagination using CSS. For more information, please follow other related articles on the PHP Chinese website!