In a technical book, it is common to have a reference to material in another part of the book. Can I use something like an <a href=""> tag in the HTML to provide a direct link? How would I do this when creating an ePub from scratch using raw, manually edited HTML?

I can see that this would also be useful for creating an index page.

  • If you want to create an index page, might I suggest e.g. DocBook or DITA for creating your book (then transforming to EPUB) instead of hand crafting it? Indexes are valuable but specialized, and a more structured approach might help. May 5, 2014 at 21:23

2 Answers 2


You can certainly use standard <a> tags with matching ids to create hyperlinks within an epub file, yes. The structure of the text could look like:

<p class="body">Here is a bunch of text with a footnote <a epub:type="noteref" href="notes.xhtml#note1" class="reference" id="ref1">[1]</a></p>

With a matching note in a notes.xhtml file:

<aside epub:type="rearnote" class="note" id="note1">1: Here is the related endnote <a href="ch1.xhtml#ref1">[link back]</a></aside>

There are a few best practices to consider:

  • Make sure to give a reciprocal link for endnotes--that is, once you can click on the number to go read the endnote, you'll need another link to bring you back to the text from the endnote
  • In the index, it's very handy to have a series of links at the top for each alphabetic subsection, so that a reader can select "G" and go to the "G" section of the index. The "G" subheader can then be a link back to the top of the index.
  • If you're using epub 3.0, you should definitely add epub:type semantic markup for indices and foot/end notes. The details of that can be found in the Structural Semantics Vocabulary. These semantics enable reading systems to associate behaviors with certain kinds of content. This is what iBooks uses to generate popup footnotes, and if you've properly marked up your content, you're giving it the chance to get additional features with no more effort as reading systems design more functionality for that markup.

Indices can be pretty painful to create if the production files weren't tagged correctly at the time of creation; one quick-and-dirty method to consider in that case is to insert <span epub:type="pagebreak" id="page1" /> into the document at each page break, then have the index link to the print page. This isn't ideal, as a print page can span multiple screens (particularly on a cell phone!), but it can get you part way there if you're interested in cutting corners.


Yes, you can use internal links in ePub files. Depending on which tool you use to generate your ePubs (I prefer Sigil), you can develop the individual internal files using HTML directly. So you can create a link with an <a href=""> tag just as you would in a webpage. This is often used in creating custom tables of contents, or links to footnotes.

To your edit: raw manually-edited ePub files are exactly the same in structure and syntax as HTML files (I'm assuming you're generating an archive of .xhtml files), so you can definitely include links just as you would when writing a webpage. If you want to link within the same page, you'll need the <a name="foo"> marker for the target, and then <a href="#foo"> for the link. To link to a different page, just include the page name as the target for the href instead.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.