CSS2: page-break-before: always;

Thursday, September 09, 2010
By keiji
Category: CSS, Web Development
Recently I had a problem to page-break using CSS on IE8 (I guess this could be a case of some of older IEs and some other browsers too?).
Here is a memo to fix that.

To use a CSS "page-break-before: always;", there are the tips:

1. Use CSS class, not inline style
2. Use @media and set "height:0px" to work. (This is the reason for #1.)
3. So, the sample definition is:

@media print
{
	.PAGEBREAK
	{
		page-break-before: always;
		height:0px;
	}
}

So, now you can use:

<div class='PAGEBREAK'></div>

when you want to have a page break.

Comments

N/A

Reply to

Subject:
Name:
E-Mail:
Comment:
(Max 1000 chars)
Confirmation Key:
Please enter the value displayed in the image.
Send Send