EPUB is a website in a ZIP file
Unzip an .epub and you find XHTML documents for the chapters, CSS for styling, images, and a package file — usually content.opf — that lists everything, records the metadata, and defines the reading order. There is also a navigation document providing the table of contents. Knowing this is why an EPUB can be inspected in a browser: the content is already HTML.