Warning: Invalid argument supplied for foreach() in /home/techrecipes/public_html/wp-content/themes/techrecipes/header.php on line 77

HTML Printing: Use a Style Sheet to Force a Page Break

Designing web pages for printing can be difficult. This tutorial explains how to force a printer to insert a page break.


Designing web pages that can be easily printed can be very, very difficult. PDFs are perfect, but they are expensive to do dynamically. Here is a cheap way to insert a page break into a page.

Place the following code in the HEAD of the html:

<STYLE TYPE='text/css'>
P.pagebreakhere {page-break-before: always}
</STYLE>

Then place the following code in the BODY of the html where you want the pagebreak:

<P CLASS="pagebreakhere">

The Conversation

Follow the reactions below and share your own thoughts.

  • JO’C

    this does not work.

  • Anonymous

    Even simpler:< style=”page-break-before: always” />

  • Anonymous

    Even simpler:

    <br style=”page-break-before: always” />

  • Bruce

    Thanks to the author as well as dkgibson for this useful tip.

  • http://www.printingblue.com/vinylbanners-printing.asp banners printing

    Its not working. generate unexceptional error handling.