Mike Valstar Mike Valstar - 1 year ago 204
CSS Question

Google Chrome Printing Page Breaks

I'm trying to get google chrome to do page breaks.

I've been told via a bunch of websites that

page-break-after: always;
is valid in chrome but I can not seem to get it to work even with a very simple example. is there any way to force a page break when printing in chrome?

Answer Source

I've used the following approach successfully in all major browsers including Chrome:

<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <title>Paginated HTML</title>
    <style type="text/css" media="print">
        page-break-after: always;
        page-break-inside: avoid;
    <div class="page">
      <h1>This is Page 1</h1>
    <div class="page">
      <h1>This is Page 2</h1>
    <div class="page">
      <h1>This is Page 3</h1>

This is a simplified example. In the real code, each page div contains many more elements.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download