If you really don’t like the Kindle’s default chapter styles, then a workable alternative is to use an image instead. Of course, this means creating a different image for every chapter, which is time-consuming if your book is long, but it will look really nice if it’s done well. You could maybe ask the person who’s designing your cover for advice (or get him or her to do these graphics for you as well).
Instructions
Your image should be a GIF and, as discussed in the section on section break graphics, you have to enter the size of the graphic to stop the Kindle resizing it.
The CSS you need is the same as what you’ve been using for text, because graphics in this case are treated in the same way.
h1{ text-align:center; page-break-before: always; margin-bottom: 2em;}
Obviously, if you want your graphic to be left- or right-aligned, change the text-align
value accordingly.
Now, putting the image in is not difficult at all; assuming your chapter headings are wrapped in <h1> … </h1> tags, simply adding the HTML code to insert an image between the tags will work. The only problem is that your conversion program has no information on which to build a table of contents.
This is not too difficult to fix; however, I’ve only been able to get this working with Calibre and not with MobiPocket Creator.
Here’s the HTML you’ll need:
<h1 title="Chapter 1"><img src="Chapter1.gif" height="221px" width="250px" alt="Chapter 1" ></h1>
The text you put in the quotes after h1 title
is what will appear in the table of contents. Change the height and width values to match the size of your image.
You should also add an alt=”” tag – this is alternate text for an image. When someone is using text-to-speech, an eBook should speak this text when it encounters an image. Unfortunately the Kindle ignores this (poor show, Amazon), but you should still include it – ePub files will not validate unless images have alt tags. (Hopefully Amazon will fix this oversight in a firmware update.)
We now need to tell this to Calibre. The instructions for converting to Calibre are here; in the Table of Contents pane in the Convert dialog, press the magic wand button by the Level 1 TOC field. Enter the following values;
- Under ‘Match HTML tags …’, enter
h1
- Under ‘Having the attribute’ enter
title
. Press OK
Bear in mind that, in this case, the output of Calibre’s built-in reader will not be the same as the output in Kindle Previewer or the Kindle.
A sample layout
Kindle file: imageheading.mobi
Source HTML file and images: imageheading.zip
In my prospective Freemasonry-themed conspiracy thriller, I’ve used some Masonic compasses as chapter headings. In the Kindle file, these chapters output as ‘Chapter 1’ and ‘Chapter 2’ in the table of contents. The images are about 17KB each.