I am trying to decipher the epub spec in regards to divisions. What I have is a text that is divided into files sort of like this:
One: Title — with text
<p style=”padding-left: 40px;”>Author A — with text</p>
<p style=”padding-left: 80px;”>Recipe A</p>
<p style=”padding-left: 40px;”>Author B — with text</p>
<p style=”padding-left: 80px;”>Recipe B</p>
Two: Title — with text
<p style=”padding-left: 40px;”>Author C — with text</p>
<p style=”padding-left: 80px;”>Recipe C</p>
I am tempted to put the major sections in epub:type=”part” at h1 with each Author and Recipe as separate epub:type=”chapter” as h2’s in those parts but I am not sure how that plays out from an a11y POV.
May 16, 2023 at 2:12 pm
Thank you for your question!
Yes, you can divide parts and chapters in that manner. You can use h1 for part headings and all the chapters within that part can have the chapter headings as h2. For example:
<section epub:type=”part” role=”doc-part” aria-labelledby=”part1″>
<h1 class=”part_style” id=”part1″>Part One</h1>
<section epub:type=”chapter” role=”doc-chapter” aria-labelledby=”ch1″>
<h2 class=”chapter_style” id=”ch1″>Chapter One</h2>
I’m unsure about where the code you’ve written would be placed. Is that for the Contents page that lists all the parts and chapters, etc.? I would avoid using in-line styles (style=”padding-left: 40px;” for example) and use class= instead for styling as that is an a11y best practice.
May 18, 2023 at 1:49 pm
Lol. The code was from this site. I tried to use the indent function to be clearer but actually made it worse. Maybe something for your web people to look at.
Thanks for the response. I got a bit turned around when I found out subchapters were deprecated because that seemed to be exactly what I wanted.
May 19, 2023 at 1:37 pm