EBW Knowledge Base

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.

3 Comments

  1. Sergio says:

    And in the case you have several xhtml but you don’t want a page break between them. It is possible? How can be do it?

    I need to resolve this because of the limitation of the Sony reader, where you can not use files of more than 300kb, so I need to split some xhtml into several files, but I don’t want a page break between them.

    Thank you so much

  2. Arthur Attwell says:

    Sergio: The page break between XHTML files is determined by the ereading system (in your case, the Sony reader’s firmware), so there is no way to affect this in the epub, I’m afraid. (If there are other ways to deal with this problem, the Mobileread forums are the place to ask: http://www.mobileread.com/forums/.)

  3. Sergio says:

    Ok,I will try!

    Thank you so much Arthur!

Leave a Reply