01-30-2017, 01:04 PM | #1 |
Head of lunatic asylum
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
|
2 CODES: variant forms of spelling
These 2 codes for linking a content entry to the chapter - they work both (separately of course). Question: There are any differences (in the outcome) or not? Code:
<h4 id="uAIKIQFfF5UME83PA4zUdR8"><a href="Inhalt.html#qwerty">II. Bar</a></h4> <h4><a href="Inhalt.html#qwerty" id="uAIKIQFfF5UME83PA4zUdR8">II. Bar</a></h4> Last edited by chaot; 01-30-2017 at 02:34 PM. |
01-31-2017, 08:40 AM | #2 |
A Hairy Wizard
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Effectively they will do the same thing. However, the link will point to the element with the ID. <h4 id=...> would link to the <h4> tag, while <a id=...> points to the actual letters themselves. If you have some bizarre css styling it could throw off your result. Such as:
CSS h4 {margin-top:15em} or a {margin-left:75%} could have the link point to the incorrect page on smaller screens, or the wrong point on the page. |
Advert | |
|
01-31-2017, 03:54 PM | #3 |
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
|
If these were generated by an automatic program then the semantics is causing you to see different outcomes that go to essentially the same place. The h4 id is a normal target for forward links in TOC's while the id generated inside the href statement was probably generated to allow for a return link to allow you to return after the jump.
Dale |
01-31-2017, 04:15 PM | #4 |
Resident Curmudgeon
Posts: 73,877
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Are you still insisting on making headers into links? It's a waste of code and given that you have amount of space in each ePub XML, you really don't want to have this code that can be done with link(s) in the NCX ToC.
|
01-31-2017, 05:47 PM | #5 | |
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:
Dale |
|
Advert | |
|
01-31-2017, 06:13 PM | #6 |
Resident Curmudgeon
Posts: 73,877
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
That's nothing to do with what I am trying to say. I'm trying to say to NOT use the headers as links to link back to the internal ToC. That's just looks shabby and takes up space that could maybe be needed to keep within the mobile ePub specs.
|
02-01-2017, 01:14 AM | #7 |
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
|
I understand you don't like inline TOC which is your right but not everyone agrees. In this case I wasn't even talking about inline TOC. The link back I was referring to was a footnote. A perfectly acceptable way to to any sort of paper.
Dale |
02-02-2017, 05:51 AM | #8 | |
Head of lunatic asylum
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
|
Allow me to start the question with clearer formulation and code again.
To @JSWolf Spoiler:
Now we speak about an general coding question!
Files Browser Title A & Title B are chapters with headers in <h2> tags. Each chapter includes one second title Aa and one subtitle SubtitleAa (respective Bb & SubtitleBb) in <h2> resp. <h3> tags. Chapter Title A would look like: Code:
<body> <h2 id="auto1Gen1Code1">Title A</h2> <p>Introducing text</p> <h2 id="auto2Gen2Code2">Aa</h2> <p>Some text</p> <h3 id="auto3Gen3Code3">SubtitleAa</h3> <p>More text</p> <h2 id="auto4Gen4Code4">End</h2> <p>Closing phrase</p> <body> a) Content or b) to the respective entry there? (We don't speak about the auto-generated ToC.) To allow for all possibilities: <hx id=...> instead of <a id=...> ! Quote:
I think now I have expressed myself clearly. Last edited by chaot; 02-02-2017 at 06:01 AM. |
|
02-02-2017, 05:56 AM | #9 |
Resident Curmudgeon
Posts: 73,877
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
What I think would work would be to have the main header to the left and the sub-headers for that section to be indented. Then a blank line for the next section and so on.
|
02-02-2017, 07:34 AM | #10 | |
A Hairy Wizard
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
Instead of telling you what your styling should look like, the answer to your question is to use an <a> with an href back to your ToC page: a) To take you back to the top of your Contents page <h2 id="auto1Gen1Code1"><a href="../Text/contents.xhtml">Title A</a> b) To take you back to the respective entry ON the Contents page would require each of the entries on the contents page to have a specific id <h2 id="auto2Gen2Code2"><a href="../Text/contents.xhtml#IDforAa">Aa</a></h2> and <h3 id="auto3Gen3Code3"><a href="../Text/contents.xhtml#IDforSubtitleAa">SubtitleAa</a></h3> where your TOC page has something like this: Code:
<ul> <li id="IDforTitleA"><a href="../Text/somepage.xhtml">TitleA</li> <li id="IDforAa"><a href="../Text/somepage.xhtml#auto2Gen2Code2">Aa</li> <li id="IDforSubtitleAa"><a href="../Text/somepage.xhtml#auto3Gen3Code3">SubtitleAa</li> </ul> You can have the id for each item on your contents page either in the <li> as shown in the example above, or in the <a> tag itself (eg <li><a href="../Text/somepage.xhtml" id="IDforTitleA">TitleA</li>)...the result is effectively the same unless you have some really crazy styling as I mentioned in my post above. Cheers! |
|
02-02-2017, 07:41 AM | #11 | |
Resident Curmudgeon
Posts: 73,877
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
ePub has an external ToC that's very easily accessible. You can put links to the internal ToC in there. Also, Kindles don't need this either as they have a similar way to access the ToC. So all this does is look bad, be bad, and is poor coding. |
|
02-02-2017, 08:23 AM | #12 |
A Hairy Wizard
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Regardless of JSWolf's opinion about not liking inline ToC...
- It does not look awful...you can style your headers and links however you want to using the appropriate CSS. - It does not take up ANY space in the flow...its a link...they are non-space taking... - It is needed if the user wants to have an inline ToC and have their headers take them back to that ToC....which was the OPs question. - ePubs and some devices/apps do have an external ToC capability. But that was not the OPs question, either. In conlusion: It doesn't have to look bad....it certainly isn't bad (it's code)...and it's not poor coding. It is how you accomplish what you asked for - regardless of some people's dislike for inline ToC. BTW, I don't care for inline ToC either, but that makes no difference to the OP. Furthermore, I do believe Amazon/Kindle requires an inline ToC.... Cheers, |
02-02-2017, 11:36 AM | #13 | ||
Grand Sorcerer
Posts: 6,495
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
Quote:
Quote:
Last edited by jhowell; 02-02-2017 at 12:34 PM. |
||
02-02-2017, 12:08 PM | #14 |
Resident Curmudgeon
Posts: 73,877
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Any code takes up space. The space is not just allocated for text. It's the size of the entire flow including ALL of the coding.
|
02-03-2017, 12:22 PM | #15 |
A Hairy Wizard
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
So, your only true complaint is that the links make the file size .01 kb larger...noted.
Thanks for the correction jhowell! |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Forms or Interactive PDF | Psyny | Amazon Kindle | 4 | 01-12-2015 02:56 PM |
Fillable forms | soparch | ePub | 2 | 06-29-2012 09:12 AM |
DR1000 FW2.0 - RC2 - font-variant: small-caps | ThR | iRex | 0 | 06-29-2010 05:31 AM |
John August's sales figures for The Variant | Sporadic | News | 28 | 07-15-2009 02:23 PM |
John August - The Variant (Short Story - $0.99 - Kindle/PDF) | Sporadic | Deals and Resources (No Self-Promotion or Affiliate Links) | 0 | 05-24-2009 11:16 AM |