Electric Book Works Web, mobile and print publications

Page breaks

Most ereading systems (such as Adobe Digital Editions) will create a page break by default between each XHTML/HTML file in the epub package. So if chapter 1 and chapter 2 are in separate XHTML files in the epub package, an ereader will put a page break between them.

However, there may be times when you want extra page breaks. For instance, if you’ve gathered all your prelim pages into one XHTML file (say, title page, copyright details, and dedication), you may still want to put a break break between them. You may also want to put page breaks before major headings. There are two ways to do this:

  • in the CSS: tell the CSS file to always put a page break before certain kinds of heading or paragraph (e.g. always put a break break before A-heads)
  • in the XHTML: manually put a page-break tag into the XHTML at the relevant place.

Page breaks in CSS

If you want page breaks before, say, chapter/section heads, add this line to the CSS declaration for the relevant chapter-head style(s):

page-break-before:always;

Note: You can also use page-break-after:always; if you ever have reason for breaking after a style rather than before it (e.g. a part-title page with only a heading on it).

The advantage with putting the breaks in the CSS rather than the XHTML is that you can turn them on or off with one change to the CSS. The downside is that any ereading system that overrides or ignores your CSS will not show these page breaks, and your text will just run on.

Page breaks in the XHTML

If you want to add page breaks manually (i.e. not applied to a style, just in particular places in the document), add this line to the XHTML file where you want the break:

<div style="page-break-before:always;"></div>

That puts a blank spot in the XHTML document styled locally with a page break.

Arthur Attwell 17 February 2010
This information is more than two years old, and may no longer be accurate. Contact us to check, or log an issue on GitHub.