web analytics

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

Options

codeling 1602 - 6666
@2016-10-13 08:48:35

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.

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com