Page Breaks in Google Chrome Printing
In Google Chrome, achieving page breaks during printing can be challenging. Despite documentation suggesting the validity of page-break-after: always;, this method may not always work effectively.
Solution
To reliably force page breaks in Chrome, the following approach has been proven successful:
Create a unique
Assign the CSS class "page" to each
Within the "print" media query of your CSS, define the following rules:
div.page { page-break-after: always; page-break-inside: avoid; }
For example:
<div class="page"> <h1>This is Page 1</h1> </div> <div class="page"> <h1>This is Page 2</h1> </div> <div class="page"> <h1>This is Page 3</h1> </div>
By following this approach, you can ensure consistent page breaks when printing from Google Chrome, regardless of the content size or complexity.
The above is the detailed content of How Can I Reliably Force Page Breaks When Printing from Google Chrome?. For more information, please follow other related articles on the PHP Chinese website!