![]() |
#1 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 342440
Join Date: Apr 2017
Device: Sigil
|
TOC links point to wrong page!
The adventure continues! Whenever I think I have finished my first EPUB, I find another problem!
![]() This time I have noticed that some of the links in my table of contents, generated by Sigil, point to the page before the destination page. This means that I have to click the link and then flip one page forward to arrive at my intended destination. Having taken a close look, it only seems to occur whenever the destination is a h3 heading and the heading starts at the top of the page. My h3 heading elements have the largest top margins of all the elements in the EPUB, so I am assuming that some of the top margin is being left on the previous page. Is this possible? Has anyone ever experienced this problem? |
![]() |
![]() |
![]() |
#2 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 342440
Join Date: Apr 2017
Device: Sigil
|
Note that when I check the TOCs in Sigil, every link works perfectly. The problem occurs in ADE and Kindle for Android.
|
![]() |
![]() |
![]() |
#3 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 342440
Join Date: Apr 2017
Device: Sigil
|
Ohhh! I see what's going on . . .
My TOC is three levels deep (h1, h2, and h3). As chapter headings and subheadings, my h1s and h2s all start at the beginning of a HTML document. My h3s are the only headings that are placed throughout the body of the content. In order to push the h3 headings down, I have assigned them large top margins. Whenever a h3 heading happens to start at the top of a page, the top margin is being split between the top of the page and the previous page. If I adjust the font size and thus move the h3 headings away from the top of a page, the problem goes away. I think I can fix this problem by giving the h3 headings the same sized top margin as the previous element's bottom margin. Lemme see . . . Last edited by fluoresce; 05-10-2017 at 06:45 PM. |
![]() |
![]() |
![]() |
#4 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,221
Karma: 35037583
Join Date: May 2011
Location: PA {back in the usa!}
Device: Sony PRS-T2, ADE on PC
|
Try using padding-top instead of margin-top. That will place the whitespace within the h3 "block" instead of above it. I use padding for all chapter headings, and seems to work always.
|
![]() |
![]() |
![]() |
#5 | |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 342440
Join Date: Apr 2017
Device: Sigil
|
Quote:
![]() Check your books. I bet the same thing happens. |
|
![]() |
![]() |
![]() |
#6 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 342440
Join Date: Apr 2017
Device: Sigil
|
I need a space above my h3 headings. How do I do it without experiencing this problem?
Any suggestions will be appreciated. |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
You will always have issues when the header doesn't quite fit on the page. If you want a margin above a H3 and have the H3 always at the top of a page, the most consistent manner would be to give the H3 a separate page/XHTML file.
|
![]() |
![]() |
![]() |
#8 | |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 342440
Join Date: Apr 2017
Device: Sigil
|
Quote:
The h3s are distributed throughout the body of the content. Whenever one of them happens to be at the top of a page, the TOC link that points to that h3 header instead points to the previous page, as if a piece of the h3 header's margin is being left on the previous page. I suppose the only two ways of fixing this issue are to either do as you say and place each h3 at the top of a new document or push each h3 down with the previous element's bottom margin. |
|
![]() |
![]() |
![]() |
#9 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
|
Quote:
Code:
page-break-before: always BobC |
|
![]() |
![]() |
![]() |
#10 |
Age improves with wine.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 576
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
To make it easier, instead of tracking down and fixing every preceding element, you could just insert and extra div before each h3 to give you your margins: i.e. replace every occurrence of "<h3" with "<div class='h3-margin'/><h3" and define h3-margin as "margin-top:5em" or whatever.
|
![]() |
![]() |
![]() |
#11 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,741
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
If you want to have a page break at every <h3>, then the best solution is to start a new file at every <h3>.
|
![]() |
![]() |
![]() |
#12 |
Age improves with wine.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 576
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
I think the idea is not to have a page break at every <h3>, but to link to the text rather than the top margin of the <h3> when the top margin appears at the bottom of one page and the text appears at the top of the next page.
|
![]() |
![]() |
![]() |
#13 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,741
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
In that case, for the <h3>, don't use a top margin. It doesn't work when the margin falls at the bottom of the screen. Use padding-top instead. That does work.
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can a toc.ncx point to an empty content tag? | twedigteam | ePub | 7 | 02-08-2013 11:57 AM |
pdf links go to wrong page | uglyoldbob | Onyx Boox | 3 | 07-20-2012 10:20 AM |
Kindler previewer not recognizing toc.ncx file, my html toc, or the start point... | petercrowell | Kindle Formats | 2 | 05-01-2012 08:14 AM |
Creator Should my ToC have links? | roromx | Kindle Formats | 8 | 01-13-2012 02:33 PM |
Generated TOC links back to TOC page in the book | Caleb666 | Sigil | 7 | 08-17-2011 11:58 AM |