Home > Web Front-end > CSS Tutorial > Control pagination using CSS

Control pagination using CSS

WBOY
Release: 2023-08-25 10:57:02
forward
756 people have browsed it

使用 CSS 控制分页

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.

Example

You can achieve this using the following rules

<style>
   <!--
      h1 {
         page-break-before : right
      }
      h2 {
         page-break-after : avoid
      }
   -->
</style>
Copy after login

The above is the detailed content of Control pagination using CSS. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template