The <h?> tags are more semantically correct when used to define/differentiate what
level 'header' you are using. You can style your headers however way you wish, or no way at all. Some devices might apply default styles to a header when that device doesn't use the publisher's css. As mentioned previously, some programs like
Sigil and
Calibre Editor can auto create TOC based on the header tags.
I use them in a heirarchy like this:
Spoiler:
Code:
<h1> cover </h1>
<h2>front matter like dedication, synopsis, title page, etc.</h2>
<h3>Chapters</h3>
<h3>Graphics, epigraphs, maps, etc.</h3>
<h2>Appendix Title</h2>
<h3>Appendix 1</h3>
<h3>Appendix 2</h3>
<h3>Appendix 3</h3>
<h2>back matter like 'about the author', acknowledgements, author notes, etc.</h2>
<h1> back cover (if there is one) </h1>
- OR -
<h1> cover </h1>
<h2>front matter like dedication, synopsis, title page, etc.</h2>
<h3> Parts, Books, etc</h3>
<h4>Chapters</h4>
<h4>Graphics, epigraphs, maps, etc.</h4>
<h3> Parts, Books, etc</h3>
<h4>Chapters</h4>
<h4>Graphics, epigraphs, maps, etc.</h4>
<h2>Appendix Title</h2>
<h3>Appendix 1</h3>
<h3>Appendix 2</h3>
<h3>Appendix 3</h3>
<h2>back matter like 'about the author', acknowledgements, author notes, etc.</h2>
<h1> back cover (if there is one) </h1>
I also use css similar to the example provided by DNSB, but mine relies a little more on the rules of CSS to define styling rather than giving everything a class name. This approach is perfectly valid and, IMO, provides a little cleaner html code:
I don't particularly use the <section> tag. I haven't needed it - but I haven't really gotten into ePub3 spec. I break up each chapter into its own file so really don't need another tag to say it's a chapter. I
do use <div> tags to give special formatting to a section of the file. To me that serves the same purpose.