What I mean is that some reading applications, like iBooks, did not bother to create an ePUB rendered which honors the specifications, but used a web-renderer. Although in a lot of cases the result is the same, it is not always the case. This is because the ePUB specifications differ from XHTML and CSS2 specifications. Sometimes this results into unexpected results.
Anyway, I looked at your code and I would actually expect the result you have in your screenshot. So, what did you expect?