How to add page breaks to a printer-friendly web page Options

codeling Posts: 1089 Points: 4569
Posted: Thursday, October 13, 2016 8:48:35 AM

Starting with the release of Cascading Style Sheets 2 specification, you can finally suggest to browsers when to break pages when printing your web pages.

To suggest a page break, add <P style="page-break-before: always"> before the beginning of a new printed page. For example, if you place the following tags on a HTML page and print it using a compatible browser, you will end-up with three pages with the sample text.

<html>
<body>

This is the text for page #1.

<p style="page-break-before: always">

Page #2...

<p style="page-break-before: always">

Page #3...

</body>
</html>

The following figure shows the three printable pages in the Print Preview.

 
Users browsing this topic
Guest