WWW FAQs: How do I put page breaks in a web page?

2003-10-01: thanks to cascading style sheets, it is possible to give modern web browsers a "hint" to help them put page breaks in the right places when printing out web pages. Here is an example:

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

This will force a page break when printing, before the start of this particular <p> element.

Not all web browsers support CSS perfectly. If you must have absolute layout control and are primarily concerned with printing, consider using PDF rather than HTML.

Share |

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!


Follow us on Twitter | Contact Us

Copyright 1994-2014 Boutell.Com, Inc. All Rights Reserved.