06-23-2013, 12:38 AM | #1 |
Novice
Posts: 14
Karma: 10
Join Date: Jun 2013
Device: Kindle Paperwhite
|
Will my anchors lead astray?
I have styled my chapter headings with a paragraph class containing the styling element page-break-before: always;.
According to Amazon's guidelines I should add my anchor tags (<a name="*"/>) before my paragraph tags. Code:
"3.10.2 HTML Guideline #2: Anchors Must Be Added Before Formatting Tags" For example, could a ToC item linked to this anchor end up directing someone to a blank page or even the page before the chapter heading? The intention is of course that the anchor should lead to the chapter heading. If this would be a problem, I guess I could use the <mbp:pagebreak/> tag - but I had understood the CSS method to be more practical and also best practice. I could be wrong about that, though. Thanks in advance! Namaste, Santosha |
06-23-2013, 02:54 AM | #2 |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
IMHO, it's a bad idea to use paragraph tags for chapter headings. Use heading tags (h1...h6) with ids instead. For example:
Code:
<h1 id="c1">Chapter 1</h1> Code:
<a name="c1"></a><h1>Chapter 1</h1> |
Advert | |
|
06-23-2013, 06:55 AM | #3 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Do the guidelines actually use a name? Whenever I import my old web pages into Sigil, I get an error with that usage. Evidently we are now supposed to say id=, as Doitsu suggests. (And it is much cleaner!)
|
06-23-2013, 07:26 AM | #4 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
"name" is deprecated in favour of "id" in XHTML, which is what ePub is based on. But mobi uses some old pseudo-HTML code, where "name" is perfectly valid.
Sigil is an ePub authoring tool Amazon uses mobi that's the difference. |
06-23-2013, 07:58 AM | #5 |
Grand Sorcerer
Posts: 27,468
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Even if you use "id" in place of "name," it's best to put those anchors before the header or other element you're linking to, like the guidelines say.
Of course the best way to avoid the styling "quirks" that can occur with MOBIs when linking to your various chapters is to not use url fragments at all. Instead, break your chapters into individual html files and link directly to the files (with no fragment). That way you don't have to worry about the "quirk" (and you won't need to use "page-break-before: always;"). Footnotes can still be problematic, but as long as you follow the guidelines and put the <a id="foo" /> anchor before your styled "target," you'll be alright. |
Advert | |
|
06-23-2013, 03:05 PM | #6 | |
Novice
Posts: 14
Karma: 10
Join Date: Jun 2013
Device: Kindle Paperwhite
|
Quote:
I will check out Sigil and give it a whirl. I was under the impression that heading (<hn>) tags were more difficult to style, since they already have some embedded styling and any additional styling given to them via CSS might create conflicts due to the way e-readers handle headings. Is this incorrect? Can I for example use <hn> tags to style Part- and chapter headings, and then also add elements such as text-indent:0em;, italics, and so on? Do heading tags style with relative sizes (ems)? That was the beauty I was happy to have found with styling headings with p class tags, since I could use relative units to make sure they always remained in correct relativity. Thanks so much for all the help on the basics, it's really appreciated! |
|
06-23-2013, 03:07 PM | #7 | |
Novice
Posts: 14
Karma: 10
Join Date: Jun 2013
Device: Kindle Paperwhite
|
Quote:
So id works with both epub/mobi/KF8 then? P.S. Happy "Midsommar", if you celebrate it! D.S. |
|
06-23-2013, 03:15 PM | #8 | |
Novice
Posts: 14
Karma: 10
Join Date: Jun 2013
Device: Kindle Paperwhite
|
Quote:
I really like the idea of separating everything into different HTML files (for many reasons, clarity of overview and workflow being two of them) -- and will look more into it. I'm a little confused as to how to tell the compiler (e.g. KindleGen) actually pieces together the file in such a case, and how ToC links remain intact etc., do you have any suggestions where I could read up on this method of breaking it all up? Is it the manifest or spine in the OPF that make sure they're placed in the right order? When you say URL fragment, do you mean the way anchors link to chapters by referencing within a document, i.e. with #chapter1 referencing the id="chapter" element or am I misunderstanding? Oh, and DiapDealer -- If I compile my ebook file with different files for different chapters in this way, do they automatically receive a page-break between them? I'm sort of implying from what you're saying in your post about not having to use the page-break-before:always;, but don't really understand how you mean. Last edited by santosha; 06-23-2013 at 03:18 PM. Reason: Added question |
|
06-23-2013, 04:00 PM | #9 | |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
BTW, Sigil uses the title attribute for all auto-generated TOCs. This'll allow you to automatically generate TOC entries that differ from the actual heading text. For example: Code:
<h1 id="c1" title="1">Chapter 1<br />The Beginning</h1> |
|
06-23-2013, 06:28 PM | #10 | |||
Grand Sorcerer
Posts: 27,468
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Quote:
Quote:
|
|||
06-24-2013, 05:01 PM | #11 | |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Quote:
We don't exactly celebrate Midsommer, but we do take note of it, though we think of it more awkwardly as Longest Day Of The Year.... |
|
06-25-2013, 05:31 AM | #12 |
Bookmaker & Cat Slave
Posts: 11,448
Karma: 157030631
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
|
06-28-2013, 10:45 PM | #13 |
Novice
Posts: 14
Karma: 10
Join Date: Jun 2013
Device: Kindle Paperwhite
|
Thanks a lot for you guys' help Doitsu, NJ and Diap!
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Anchors in posts? | unboggling | Feedback | 16 | 05-17-2015 03:18 PM |
Links and anchors | dicknskip | Sigil | 6 | 04-11-2013 11:43 PM |
Links and anchors question | holdit | ePub | 10 | 02-15-2013 03:28 PM |
Anchors look like links in ADE? | BKh | Workshop | 8 | 01-29-2012 03:19 PM |
Help With Capital Letter Going Astray | Marcy | Calibre | 3 | 08-10-2010 11:38 AM |