06-04-2012, 07:26 AM | #1 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2012
Device: none
|
Kindle (sometimes) displays bits of HTML
I’m having a weird display problem with a mobi file I’m working on: The ebook has endnotes, with the links in each endnote back to the original text. For 2 of the 16 endnotes, when I jump back to the text from the note, the first line of text on the kindle screen starts with a bit of code like this:
p height=”1em” width=”0pt”> I searched through the original HTML file, but I couldn’t find any difference between those 2 links and any of the other ones which could account for this issue. This happens on a regular Kindle and in the “Kindle Previewer” app for Mac but not in the Kindle apps for iOS or Mac. Here’s a screenshot from Kindle Previewer for Mac: The Mobi file was created by Calibre from a hand-coded HTML file. Any idea what could be causing this? TIA Last edited by stam.scribe; 06-04-2012 at 07:38 AM. Reason: Inserting image |
06-04-2012, 07:51 AM | #2 |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
It's a known bug with Kindle devices. It's even exhibited in the Kindle Previewer. The way to avoid it is to put your anchor point before/outside of the element you're trying to link to.
Consider this end-note link encountered in the text of a document: Code:
<a href="#endnote1">[1]</a> Code:
<p id="endnote1" class="endnote">This is my first endnote.</p> Code:
<a id="endnote1" /><p class="endnote">This is my first endnote.</p> Code:
<a id="endnote1"></a><p class="endnote">This is my first endnote.</p> Last edited by DiapDealer; 06-04-2012 at 07:55 AM. |
Advert | |
|
06-04-2012, 09:49 AM | #3 | |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2012
Device: none
|
Quote:
Any idea why the bug would always show up in the same 2 places and never show up anywhere else? There in no difference (that i can see) in the code. |
|
06-04-2012, 10:42 AM | #4 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2012
Device: none
|
Aaaand… DiapDealer’s solution fixed my problem… and introduced a new problem: When the <a id=“whatever> tags are outside the <p> tags, any space between paragraphs (specified in CSS) is stripped out.
Any thoughts? |
06-04-2012, 11:16 AM | #5 |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Hmm... I've never experienced that problem. But that's likely due to the fact that I rarely have any space between my paragraphs except at scenebreaks... and I normally use Kindlegen to produce my MOBIs. But it still should be possible to get it worked out.
Any chance of getting a sample snippet of the html and css involved? Just a couple of paragraphs where spacing is expected and it's not coming through on the MOBI end? Last edited by DiapDealer; 06-04-2012 at 12:36 PM. |
Advert | |
|
06-04-2012, 12:22 PM | #6 |
Wizard
Posts: 2,251
Karma: 3720310
Join Date: Jan 2009
Location: USA
Device: Kindle, iPad (not used much for reading)
|
Make sure you close the anchor tag. DiagDealer's example didn't show the anchor closure.
|
06-04-2012, 12:36 PM | #7 | |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I gave one example with a self-closing xhtml tag and one with a traditional html open/close tag pair. What did I miss? Last edited by DiapDealer; 06-04-2012 at 01:12 PM. |
|
06-04-2012, 01:40 PM | #8 |
Wizard
Posts: 2,251
Karma: 3720310
Join Date: Jan 2009
Location: USA
Device: Kindle, iPad (not used much for reading)
|
Sorry, I missed the closing slash in the anchor tag. I'm not used to anchors without text enclosed.
|
06-04-2012, 03:01 PM | #9 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2012
Device: none
|
I’m trying to generate a small mobi file that shows the problem by copying out a few paragraphs from the original HTML… Of course, in the sample file the problem doesn’t exist…
I will have to spend some more time on this later/tomorrow. Stay tuned... |
06-04-2012, 03:31 PM | #10 | |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Good luck. |
|
06-06-2012, 04:02 AM | #11 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2012
Device: none
|
Hmmm… So I generated a new mobi file from the original HTML and it displayed the same problem. Then I commented out most of the ebook (except the relevant sections) and made another mobi which didn’t have the problem. Then I tried adding in more and more of the original HTML to try to find the point where the problem begins… after 10 or 15 tries, I’m back to the full text and no display issue (at least not in the Previewer app — I have to borrow a real Kindle to make sure it’s not there as well).
Weird. The problem was consistently present even after multiple edits to the HTML file — until I took most of the text out and then put it right back in. Why would that matter??? |
06-06-2012, 08:55 AM | #12 | |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
06-06-2012, 01:53 PM | #13 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
I afraid I have to disagree with the view that this is a bug. It isn't a bug; it's simply a consequence of the fact that Mobi is stateless; when you jump to a point in the file in a Mobi book the HTML is rendered from that point onwards. When placing anchors in your code, you need to bear this in mind.
|
06-06-2012, 02:11 PM | #14 | |
Grand Sorcerer
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
06-06-2012, 06:26 PM | #15 | |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Quote:
|
|
Tags |
display problems, html, kindle |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle Previewer Displays HTML lists incorrectly when converting from EPUB | Gandharva | Kindle Developer's Corner | 1 | 09-01-2011 06:52 PM |
HTML to epub displays munged source code | haven | Conversion | 4 | 03-10-2011 10:08 PM |
epub to mobi - Displays Html tags | stevec1409 | Conversion | 7 | 02-14-2011 03:41 PM |
Calibre Recipe HTML content differs from raw html of index.html. | krunk | Calibre | 4 | 09-20-2010 09:48 PM |
Magnified Comparison of eInk / Kindle and iPad Displays | Kali Yuga | General Discussions | 4 | 08-18-2010 08:51 AM |