Headings

From DPWiki
Jump to: navigation, search
DP Official Documentation - Post-Processing and Post-Processing Verification

General principles for marking up headings

Heading elements (<h1> through <h6>) are used to mark up the headings in your HTML document. As the element names already convey, HTML knows six hierarchical levels of headings. The “largest” heading is <h1>, which, in our e-books, should be used—once per book—to mark |the book’s title. Whenever you need a sub-heading to a heading (a sub-division to, e.g., a chapter), use the next level: The largest divisions in your book, e.g., “parts” or “chapters” (depending on your book’s structure), use <h2>, thus conveying that they are on a level below the book’s title. The next-largest divisions, e.g., “chapters” if you have “parts”, or “sections” if you don’t, would use <h3>, and so on.

The easiest way of choosing the correct level for a heading is to imagine all of the heading elements as a kind of outline or table of contents to your book. Everything that would look the same in a table of contents should usually be on the same level. For information on how to view an outline for your book, see below.

Your heading hierarchy is important because in some cases it will be used to navigate the document: In “mobile” formats (specifically, epub and mobi (Kindle)), a table of contents will be generated from your headings; text-to-speech software also usually lets a user jump to a specific section by reading the document’s headings. If your headings are used solely for making text bold or larger (or any reason other than conveying the document structure), your e-book will be hard to navigate for an increasing number of users—since download numbers for e-reader versions are constantly rising.

N.B.: The auto-generated table of contents in “mobile” formats is distinct from the original book’s table of contents. If you have a table of contents in your HTML, it will still be displayed, but will not be used as the book’s “official” table of contents that shows up when selecting the relevant item from a menu or pressing the relevant button on the e-reader device.

What do I do with multi-part headings?

Many books have headings that span more than one line; it is particularly common to have books that give both a chapter number and a chapter title on consecutive lines, like this:

Two-part chapter heading


In this case, “CHAPTER II.” and “UNDER WEIGH.” constitute one heading, not a heading (chapter) and a sub-heading (section). Thus, you should mark the two lines using one heading element of the appropriate level for your book. (In most books, the title of the book would be <h1> and the chapters <h2>.) You can use additional markup to make parts of the heading bigger or smaller, bold, etc.

The following would be appropriate markup for our example:

<h2>CHAPTER II.<br/>
<small>UNDER WEIGH.</small></h2>

The corresponding CSS might look like this, or similar:

h2
{
  text-align: center;
  font-weight: normal;
  line-height: 1.5;
}

Two-part chapter heading


N.B.: If “UNDER WEIGH.” were the title of the first section of “CHAPTER II.”, it would be separately marked as the next level of heading (in this case, <h3>) instead.

What about the title page?

On the title page, you should make sure to mark the complete book title as an <h1>, and the rest of the title page as ordinary paragraphs, with appropriate CSS to replicate the original title page’s layout.

See the Case Study on Title Pages for a comprehensive explanation, including an example.

How do I find out whether my headings hierarchy makes sense?

One easy way of double-checking this is to tick the “Show Outline” checkbox on the W3C Markup Validator’s “More Options” screen, which will generate a hierarchy of all your headings for you. It should look like a table of contents to your book:

[h1] JOHN LYLY
    [h2] PREFACE.
    [h2] TABLE OF CONTENTS.
    [h2] INTRODUCTION.
    [h2] CHAPTER I. EUPHUISM.
        [h3] Section I. The Anatomy of Euphuism.
        [h3] Section II. The Origins of Euphuism.
        [h3] Section III. Lyly's Legatees and the relation between Euphuism
             and the Renaissance.
        [h3] Section IV. The position of Euphuism in the history of English prose.
    [h2] CHAPTER II. THE FIRST ENGLISH NOVEL.
    [h2] CHAPTER III. LYLY THE DRAMATIST.
        [h3] Section I. English Comedy before 1580.
        [h3] Section II. The Eight Plays.
        [h3] Section III. Lyly's dramatic Genius and Influence.
    [h2] CHAPTER IV. CONCLUSION.
    [h2] LIST OF CHIEF AUTHORITIES.
    [h2] INDEX.

Look at the outline for your book and determine whether any heading seems to be on the wrong level, whether any headings are missing, or whether there is anything on the list that doesn’t seem to be a heading at all; if anything is amiss, double-check your HTML file and correct the headings accordingly.

Further reading

To comment or request edits to this page, please contact lhamilton.

Return to DP Official Documentation Menu