Calibre is a great program to help you format and test your eBook files. In it you can manually edit your eBook .EPUB files which use HTML. We are going to reference Calibre's editing setup for these instructions.
There are 4 areas you can customize when setting up your .EPUB's HTML:
These are the sections of your book. You will need numerous of these files such as...
Title/Copyright Page
Preface/Prologue
Each Chapter
Epilogue
Basic File Setup:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>YOUR BOOK TITLE</title>
<link type="text/css" rel="stylesheet" href="OEBPS/styles/stylesheet.css"/>
</head>
<body>
<h1>CHAPTER TITLE</h1>
<p>START YOUR BOOK HERE</p>
</body>
</html>
Common HTML:
<p>Paragraph</p>
<h1>Large Heading</h1>
<h2>Sub Heading</h2>
<a href="URL">Link</a>
<strong>Bold</strong>
<em>Italic</em>
<img src="OEBPS/images/image.png" alt="Alt Text" />
This sets up basics such as fonts and sizes. Don't spend too much time on this as users often customize some of this through their eReader to their preferred reading settings.
Basic File Setup:
body {
font-family: 'Georgia', serif;
font-size: 1em;
line-height: 1.6;
margin: 1em;
}
h1 {
font-family: 'Georgia', serif;
font-size: 2em;
text-align: center;
}
h2 {
font-family: 'Georgia', serif;
font-size: 1.5em;
text-align: center;
}
p {
text-indent: 1.5em;
}
Fonts: There are a variety of fonts that work well or come pre-loaded onto many eReaders. Whichever you use, be sure to add a fallback of serif or sans-serif
This may hold your cover file along with any images you include in your book. You can reference these images using the OEBPS/images/ file path. If your book is text only, you can ignore this.
If you are using any transparent images, be sure to make sure they will be readable on white or black backgrounds. This means you may need to add a white or black outline to your image.
These files are used by eReaders to order your Text files correctly, along with offering a table of contents. If there are other files in here, leave them as-is.
The following two files reference your Text files to show a table of contents.
nav.xhtml
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>Navigation</title>
</head>
<body>
<nav epub:type="toc">
<ol>
<li><a href="section0.xhtml">Title Page</a></li>
<li><a href="section1.xhtml">Chapter 1</a></li>
<li><a href="section2.xhtml">Chapter 2</a></li>
</ol>
</nav>
</body>
</html>
toc.ncx
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
<head>
<meta name="dtb:uid" content="dc3c1522-c90d-48bd-94a5-f314c9684b68"/>
<meta name="dtb:depth" content="1"/>
<meta name="dtb:totalPageCount" content="0"/>
<meta name="dtb:maxPageNumber" content="0"/>
</head>
<docTitle>
<text>BOOK TITLE</text>
</docTitle>
<navMap>
<navPoint id="navpoint1" playOrder="1">
<navLabel><text>Title Page</text></navLabel>
<content src="section0.xhtml"/>
</navPoint>
<navPoint id="navpoint2" playOrder="2">
<navLabel><text>Chapter 1</text></navLabel>
<content src="section1.xhtml"/>
</navPoint>
<navPoint id="navpoint3" playOrder="3">
<navLabel><text>Chapter 2</text></navLabel>
<content src="section2.xhtml"/>
</navPoint>
</navMap>
</ncx>
If you get errors when submitting to eBook distributors, familiarizing yourself with this setup will help you find the problem. Usually the error messages refer to specific lines on specific pages.
And of course, you can use Calibre or your own eReader to help test your final files!