![]() |
#1 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 441
Karma: 77256
Join Date: Sep 2011
Device: none
|
Aligned chapter numbers in a TOC
Hello,
I have an HTML TOC that looks something like this: I. – Title II. – Title III. – Title IV. – Title … I'm trying to get the chapter numbers aligned by the endash as well as having the chapter title left aligned, if it wraps, after the endash. I have the chapter numbers in a span: Code:
<div class="sgc-toc-level-2"> <a href=""><span class="num">XXXVII. – </span> Title</a> </div> Code:
.num { width:5.5em; text-align:right; float:left; padding-right:.5em } |
![]() |
![]() |
![]() |
#2 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,221
Karma: 35037583
Join Date: May 2011
Location: PA {back in the usa!}
Device: Sony PRS-T2, ADE on PC
|
You might try an Ordered List with Roman Numerals.
http://www.w3schools.com/html/html_lists.asp I don't know if iBooks will honor that, but maybe worth a try. |
![]() |
![]() |
![]() |
#3 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 441
Karma: 77256
Join Date: Sep 2011
Device: none
|
I had briefly considered that, though if I have multiple sections, each with a set of chapters, the number of chapters differ and I don't think alignment by the endash or chapter title would work between sections. A table is another idea though I'm trying to stay away from that.
|
![]() |
![]() |
![]() |
#4 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,548
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I wouldn't advise using lists, ordered or unordered, styling options are limited in ePub2 and support is sloppy.
It might be possible to use some combination of left margin for the titles, and relative positioning for the numbers (maybe with width:0 or display:inline-block). But it seems alignment is wrong. This works in the browser, though, and doesn't use non-ePub2 CSS: https://jsfiddle.net/jm2j8kmn/ |
![]() |
![]() |
![]() |
#5 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 441
Karma: 77256
Join Date: Sep 2011
Device: none
|
Thank you Jellby. That looks perfect. ADE didn't like it very much, and iBooks had a slight indent for the title which I might have been able to fix with adjusting the left margin.
A hanging indent did end up working. Code:
div.sgc-toc-level-2 { text-indent:0; margin-left:5.5em } .num { width:5.5em; text-align:right; float:left; padding-right:.5em; margin-left:-6em } |
![]() |
![]() |
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,764
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
td { text-align: left; vertical-align: top; } td.first { text-align: right !important; } Code:
<table width="100%" cellspacing="10" cellpadding="0" border="0"> <tr> <td class="first">I. — </td> <td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus.</td> </tr> <tr> <td class="first">II. — </td> <td>Title</td> </tr> <tr> <td class="first">III. — </td> <td>Title</td> </tr> <tr> <td class="first">…</td> <td> </td> </tr> <tr> <td class="first">XXXVIII — </td> <td>Title</td> </tr> </table> Below you can check the respective epub. NOTE: As you can see, I styling "inline" the table; that is because ADE has "issues" with styling tables with code in the .css stylesheet. Regards Rubén |
|
![]() |
![]() |
![]() |
#7 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,548
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
How does ADE handle page breaking in tables?
|
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,764
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
![]() |
![]() |
![]() |
#9 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 441
Karma: 77256
Join Date: Sep 2011
Device: none
|
Thanks for all the code RbnJrg.
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Poetry: line numbers aligned to the right. | 1v4n0 | ePub | 20 | 12-16-2017 04:02 AM |
Chapter Page Numbers Instead of Title Page Numbers | TheArtfulDodger | Devices | 1 | 11-18-2013 01:08 PM |
Kobo (touch?) page numbers per chapter | Mrs_Often | Kobo Reader | 11 | 09-12-2012 06:03 PM |
chapter numbers are graphical | alansplace | Sigil | 6 | 07-04-2011 10:10 AM |
fixing up chapter numbers | cybmole | Sigil | 4 | 01-12-2011 02:49 AM |