Quote:
Originally Posted by paperwhite13
Thank you all for your replies! I understand your reasoning, especially if the TOC gets generated at the end, but keeping in mind my case -- I already have the TOC generated from InDesign, what would be wrong about using this? Wouldn’t it be semantically correct? I though I was just getting the hang of this
Code:
h1 {
font-family:"Font1", sans-serif;
font-size:2em;
font-style:normal;
font-weight:normal;
border-width:0;
margin-bottom:5%;
margin-left:0;
margin-right:0;
margin-top:10%;
text-align:center;
text-indent:0;
padding:0;
}
h1.chapter-no {
font-family:"Font2", serif;
font-size:1em;
margin-bottom:0;
margin-top:5%;
}
------------------
<h1 class="chapter-no">1.</h1>
<h1 id="_idParaDest-3"><a id="_idTextAnchor005"></a>>Chapter Title</h1>
|
As you can see below, I've cleaned up the code. I've fixed the spacing, removed CSS not needed. and fixed what's not correct. You do not use % for margins for chapter headers. You use em. With different devices you'll have completely different spacing. On a phone, % can take up more of the screen. On 6", 7", 8", and 10" screen, the spacing will all be different. That's not good. indents are also not good to use %. You also don't need to reset everything such as padding. You don't need L/R margins, border width. and padding if they are 0. You don't need font style if it's not doing anything.
Onto the HTML. Your ID's do nothing so you don't need them. You also don't need an <a> that does nothing but holds an id that does nothing. If in your ToC, you have these ID's, then get rid of them. If your ToC entries are going to the top of each HTML file then forget IDs. They will slow things down as the Reader has to load the HTML and then go find the ID instead of just loading the HTML and starting from the top. Also, that's code bloat when you have code that does nothing.
I changed the second line in the chapter header to be a <p> because then it won't be used if you use calibre or Sigil to generate a ToC from your headers. The title= I put in will be the ToC entry if you do generate a ToC from calibre or Sigil.
The thing is, once you export your book from InDesign as an ePub, you will need to hand edit the code. After you've done this you and you make changes to the text in InDesign you will want to make the changes to the ePub and not generate a new ePub as you will then have to once again hand edit the code. InDesign can make some rather messy code. I've edited a lot of eBooks that came from InDesign and they messy. When you hand edit, I suggest you change class names to make sense if any of the InDesign classes don't make sense.
Do you need an embedded font for the chapter titles? If you do, change the font family names to the names of the font(s) being used. But you don't need two different fonts for the chapter title. That's ugly.
[code]
Code:
h1 {
font-family: "Font1", sans-serif;
font-size: 2em;
font-weight: normal;
margin-top: 0.5em;
margin-bottom: 1em;
text-align:center;
text-indent: 0;
}
.chapter-no {
font-family: "Font2", serif;
margin-bottom: 0;
margin-top: 1em;
}
Code:
<h1 class="chapter-no" title="1. Chapter Title">1.</h1>
<p class="chapter-no">Chapter Title</p>