An ePub Tutorial‎ > ‎

Common HTML Problems

XML and Namespace Declarations

  • Not including the <?xml...?> declaration at the top.

  • Not including xmlns="http://www.w3.org/1999/xhtml" attribute in the <html> tag.

    Epubcheck would say that none of your tags are supported by the “” namespace.

Break, Formatting, and Paragraph Tags

  • Break tags that look like <br> instead of <br />.

    Epubcheck would say that it finds an unexpected closing tag that wasn’t </br>.

  • Paragraph tags (<p>) that aren’t closed (</p>).

    Epubcheck will run into the next <p> and complain about it.

  • Break tags and text formatting tags (like <tt>, <i>, <em>, <b>, <strong>, <font>, etc.) that exist outside of paragraphs.

    Epubcheck will tell you they don’t belong there.

Lists

  • Tags that were formerly allowed to run free without a closing tag can do so no longer. This includes li, dt, dd.

  • Bare list item tags (li, dt, dd) are no longer allowed; they must be inside closing ol, ul, or dl tags.

  • Lists don’t belong inside paragraphs; they must be outside of them.

Headers

  • Headers don’t belong inside paragraphs; they must be outside of them.

Images

  • Image tags that don’t end with /> (rather than simply the angle bracket).

  • Images that don’t include the alt attribute.

Anchors, aka “Missing Fragments”

  • Using <a name="..."> tags instead of the id attribute when creating anchors. Example: instead of

    <a name="illus_christmas_morning"></a><p>...</p>

    Use instead

    <p id="illus_christmas_morning">...</p>

    When you want to link to the anchor (aka “fragment”), you still use

    <a href="text.html#illus_christmas_morning">Christmas Morning</a>

    either way.

    This error generates by far the weirdest epubcheck error, where it complains that fragments are missing.

    The id way is cleaner anyways.

  • An anchor is also considered missing if the HTML around it is invalid for some reason.