Feedback on: irt.org FAQ Knowledge Base Q506
Length:
Just right
Comments:
HTMLGoodies shows you how to do add page breaks with CSS.
http://www.htmlgoodies.com/beyond/css_print.html
Technical:
Not technical enough
Comments:
IE support a Style to force a
page break on printing.
I have seen this work using the
DIV tags.
For example:
<div style=page-break-before:always>
stuff on a new page
</div>
Comments:
Yes, there is a way to force page breaks for a printer using HTML on a web page. Try this:
<DIV STYLE="page-break-before:always"></DIV>
Works on NN 4.5 and IE 5x every time.
Length:
Too short
Technical:
Not technical enough
Comments:
Set this up as a Style:
<style media=print type=text/css>
DIV.pageBreakAfter { page-break-after: always }
DIV.pageBreakBefore { page-break-before: always }
</style>
You can use this style to encapsulate in a DIV what you want on a page.
For example:
<DIV id=divMyPage class=pageBreakAfter>
<h2>Header of stuff</h2>
<p>...stuff...</p>
<HR>
</DIV>
...this example will ensure that the printer does a page break AFTER the DIV.
Worth:
Worth reading
Comments:
I just found a nasty caveat... table tags screw this up in IE 5.0.
Example:
I had a page with that looked like this:
<head>
<style media=print type=text/css> DIV.pageBreakAfter { page-break-after: always }
</style>
</head>
<body>
<table width=640 align="left" border=0 cellpadding="2" cellspacing=0 bordercolor="#000066">
<tr><td><div id=X class=pageBreakAfter>
Some text on page 1.
</div></td></tr>
<tr><td><div id=Y class=pageBreakAfter>
Some text on page 2.
</div></td></tr>
</table></body></html>
Guess what - it doesn't work! I made a very minute change - I stripped the tags on the table so it's just <table>. Now it adds page breaks where desired. Weird, huh? You don't want to know how many trees gave their lives to give me this information, so I'm giving it to you for free. :)