29 February 2008

How to insert a page break always in HTML

A common problem in HTML is how to insert a page break after an HTML element, to print a report for instance.

The solution is the page-break-after attribute defined as always.

Example:
Define the following style in the a CSS file or the HEAD HTML element:

<style> 
p { page-break-after: always } 
</style> 
In the body you can do the following: 


<div>:Insert a page break....</div> 
 
<p>This is a page break. </p> 

The text inside the <p> tag will appear in a new page.

No comments: