
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Controlling Pagination with CSS
To control pagination, use the page-break-before, page-break-after, and page-break-inside properties.
Both the page-break-before and page-break-after accept the auto, always, avoid, left, and right keywords.
The keyword 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, while 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 left-hand or right-hand page.
Using pagination properties is quite straightforward. Suppose your document has level-1 headers start new chapters with level-2 headers to denote sections. You'd like each chapter to start on a new, right-hand page, but you don't want section headers to be split across a page break from the subsequent content.
Example
You can achieve this using the following rule
<style> <!-- h1 { page-break-before : right } h2 { page-break-after : avoid } --> </style>
- Related Articles
- Add hoverable pagination with CSS
- Create a responsive pagination with CSS
- Set style for pagination with CSS
- Add space between pagination links with CSS
- How to create a pagination with CSS?
- Change the size of the pagination with CSS
- Center pagination on a web page with CSS
- Create a transition effect on hover pagination with CSS
- Controlling the Visibility of elements Working with CSS
- Add borders to pagination using CSS
- Controlling Table Layout in CSS
- Controlling Table Layout using CSS
- Controlling Whether Mouse & Touch Allowed with CSS pointer-events Property
- Achieve Pagination with MongoDB?
- Controlling the Visibility of Elements using CSS
