Please refrain from using Calibre to create ePUB. It is a very good Library program but is not very good in ePUB conversion. It generates a lot of (redundant) code and sometimes breaks fine code creating unexpected results.
It would be better to create your own ePUB from the source documents or with a tool like Sigil. Sigil will also convert your HTML to XHTML.