Fixing Smashwords Epub validation errors

validator

Wow! I’ve just landed my clean HTML code with a load of epub validation errors!

Here’s what they mean:

tags! tags! tags!

First thing to do is to double (triple) check all your code is good. I found 1 closing div tag out and I got err’s. So check them all!.

1. img tag problems? Make sure there is no space between the last ” and the end of the closing tag. Eg:

 img src="#" alt="" height="100%" /> <-- bad
 img src="#" alt="" height="100%"/><-- good

Oddly, this only appeared to error on my first image of the page. So I recommend adjusting one and then running a validation check

2. em tags. Nope. Get rid of them. I had blockquotes too. In the end I got rid of them and added some font styles to replace the em tags, eg:

 div id="blockquote" style="text-align: center; font-size: 150%; font-style: italic;"

3. sup tags! Kill sups – add the following css:

style="vertical-align:super;font-size:.6em;"

Wait up a minute…

I’ve already managed to get my file to validate – Hooray?! I’m confused because many of the errors completely disappeared by making small changes. For example: errors appear to be created by blockquote and em tags (once corrected) vanished from the rest of file. I expected an inconsistency to be, erm, consistent. But no. em and sup tags are throughout my file, but the validator doesn’t care. Certain tags appear to cause issues: I’m looking at you em tag!

This place https://code.google.com/p/epubcheck/wiki/Errors didn’t appear to be much help in figuring out what the errors meant. Ahh well, at least my file has passed validation. If the validator link above passes, then it is extremely likely that the Smashwords meatgrinder will too – as it is based on the same thing.

Done – Mark 🙂

Advertisements