54 Section Breaks, Page Breaks and Blank Pages
Pressbooks has some special code you can inject to style your section breaks (breaks within a chapter). These are safer than other methods. Below you will find code for:
- Regular section breaks
- Section break with a space
- Section break with a page break
- Section break with glyphs
- Forcing a page-break after, or before an element
- Adding a blank page
Regular Section Break
This is a regular section break, usually denoted with an asterisk. To inject such a break, add the following code in the TEXT editor:
<h3 class="section-break">***</h3>
You can add whatever you like in the between the tags and it will appear in the output, so you might want to add, say:
<h3 class="section-break">~~~</h3>
Section Break With a Space
To add a break that is just a space with nothing else, add the code:
<h3 class="section-break-space">*</h3>
The “*” will not appear in the outputs, but it’s a good idea to leave it there, for purposes of editing, and since it is always best not to have empty tags.
Section Break With a Page Break
If you want a section break that includes a page break after the break, then add:
<h3 class="section-break-page">*</h3>
Section Break With Glyphs
If you want to use an image for your section break, then you can do the following:
- Add the image using the Media Uploader (see Adding Images).
- Make sure the image is centered.
- Then make sure the image is wrapped in a centered image div, as follows:
<div class="centered-image">
<img alt="section-break" src="https://guide.pressbooks.com/wp-content/uploads/sites/10270/2014/02/image.png" />
</div>
NOTE: you can also add glyphs using special “wingding” fonts, but we’ve seen instances where these are not rendered correctly on Kindles, resulting in a “glyph” turning into a “letter.”
Forcing a Page-break After, or Before an Element
If you want to force a page break before an element (such as a paragraph), then you would add the following code:
<p class="page-break-before">Text text</p>
This will work on any block level element, such as a p tag, an h2 or h3 tag etc. So, for a page break after a heading you would add the following:
<h2 class="page-break-after">This is my heading!</h2>
Note: This will only work in PDF output. In ebooks, pagination is automatic & variable, and depends on user settings (font-size etc). In the web book, each chapter is a new “page.”
Adding a Blank Page
If you need to add a blank page for whatever reason (NOTE: this will only work in PDF output), then you can add the following:
<div class="blank-page">*</div>
Again, the “*” won’t be displayed, but it’s a good idea to add it there for editing purposes, and for the safety of not having empty tags.