11-27-2021, 09:41 PM | #1 |
Zealot
Posts: 129
Karma: 48786
Join Date: Oct 2010
Location: Australia - Adelaide
Device: Kindle3
|
Numbered list help
Hi - sorry if I'm repeating something what was already discussed here...
I created a numbered list in my epub file using negative top margin. <p class="calibre1">1.</p> /then the text related to the number/ <dd style="margin-top: -18px;">Example text one</dd> the next list number: <p class="calibre1">2.</p> /and then the related text/ <dd style="margin-top: -18px;">Example text two</dd> And so on… It seems quite simple, works OK... until I open the epub in a reader - the numbers and the related text usually became crooked – vertically misaligned… How can it be fixed so that the numbers will be always in line with the related text when opened on any device ? Thanks |
11-27-2021, 09:53 PM | #2 |
Grand Sorcerer
Posts: 6,495
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
I am curious why you believe that would ever work?
|
Advert | |
|
11-27-2021, 10:04 PM | #3 |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Have you tried html's ordered lists? There are also various sites on the web that explain how to make them prettier than they are without any CSS styling.
https://www.w3schools.com/html/html_lists_ordered.asp Also, rather than use a style= on each tag it's better to use a stylesheet. https://www.w3schools.com/css/css_howto.asp With sigil you put it in the Styles folder, then right click on the html files and select your stylesheet to link it and sigil ands the link rel= for you with the proper path. Last edited by hobnail; 11-27-2021 at 10:07 PM. |
11-27-2021, 10:04 PM | #4 |
Zealot
Posts: 129
Karma: 48786
Join Date: Oct 2010
Location: Australia - Adelaide
Device: Kindle3
|
jhowel and hobnail thanks for your answer
But it does work... The negative top margin sends the line up. Only on some devices it became misaligned. Why? I know how to create numbered list <ol> <li> or <ul> <li> I was only curious if this can be done - it seem to be possible but... Last edited by Bigo2; 11-27-2021 at 10:07 PM. |
11-27-2021, 10:17 PM | #5 |
Grand Sorcerer
Posts: 6,495
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
|
Advert | |
|
11-27-2021, 10:20 PM | #6 | |
Zealot
Posts: 129
Karma: 48786
Join Date: Oct 2010
Location: Australia - Adelaide
Device: Kindle3
|
Quote:
Also the line height can be set Last edited by Bigo2; 11-27-2021 at 10:23 PM. |
|
11-27-2021, 10:36 PM | #7 |
Grand Sorcerer
Posts: 6,495
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
|
11-27-2021, 10:50 PM | #8 |
Zealot
Posts: 129
Karma: 48786
Join Date: Oct 2010
Location: Australia - Adelaide
Device: Kindle3
|
OK - I thought there was some setting which would guarantee something will be exactly where I want it...
Why was I trying this? I wanted a different fancy font for the number, but I don't know how to do it. This way I described would have been simple. Basically I don't know how to use different fonts on the same line... Last edited by Bigo2; 11-27-2021 at 11:04 PM. |
11-27-2021, 11:32 PM | #9 |
Bibliophagist
Posts: 35,238
Karma: 145277352
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
If you think you've seen misalignment, wait until you have multiple fonts on the same line. Unless they are very carefully matched, fonts can and will have different line heights, ascender and descender values and line spacing. You are likely to find yourself generating text that resembles a ransom note.
|
11-28-2021, 12:09 AM | #10 | |
Wizard
Posts: 1,088
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
How different does the font need to be. Can it be as simple as "fantasy" -v- "serif" -v- "sans-serif" -v- "monospace" or are you trying to achieve some pretty striking gothic type text? |
|
11-28-2021, 01:00 AM | #11 |
Zealot
Posts: 129
Karma: 48786
Join Date: Oct 2010
Location: Australia - Adelaide
Device: Kindle3
|
Karellen thanks -
I don't know how to put the screenshot here - where would I send it? This concerns a Czech text concerning the Bitcoin B/S. For the common text I used "Charis SIL Compact" and for the titles I used "GemunuLibre-SemiBold" so the same Gemunu font I also wanted to use for the mumbered lists. (But I don't have to...) In the Sigil Book View (yes I'm using an older version with the Book View) as well as in the Calibre E-book viewer this looks 100% - even after AZW3 conversion. But in Kindle the lines are slightly misaligned... I thought for you code wizards here it would a simple solution... Last edited by Bigo2; 11-28-2021 at 01:05 AM. |
11-28-2021, 01:24 AM | #12 |
Wizard
Posts: 1,088
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
In the Editors bar above the text box, in the first row click on the paperclip icon.
If you don't have that icon, underneath the text box click Go Advanced. |
11-28-2021, 01:31 AM | #13 |
Zealot
Posts: 129
Karma: 48786
Join Date: Oct 2010
Location: Australia - Adelaide
Device: Kindle3
|
Karellen
Last edited by Bigo2; 11-28-2021 at 01:44 AM. |
11-28-2021, 07:05 AM | #14 | |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
1) In your .xhtml file write a normal ordered list (something like): Code:
<ol> <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc. Etiam lobortis, massa ac aliquam auctor, augue nisl sagittis urna, at dapibus tellus erat ullamcorper ligula.</li> <li>Praesent orci dui, pulvinar id convallis a, faucibus non mauris. Donec tellus augue, tempus sed facilisis sed, fringilla quis leo. Mauris vulputate, leo ac facilisis vulputate, enim orci interdum augue, in blandit quam turpis quis dui. Morbi dictum luctus velit nec faucibus.</li> <li>Cras vitae tortor purus, ut tincidunt mauris. Sed at velit nisl. Donec eu mauris tortor, interdum condimentum erat. Nam egestas turpis eget nibh laoreet pharetra. Suspendisse a sem eros, ut pulvinar enim. In sed elit eu nulla accumsan tincidunt eget sit amet ipsum. Nullam ut massa rutrum dolor placerat tempor accumsan eget purus.</li> <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc. Etiam lobortis, massa ac aliquam auctor, augue nisl sagittis urna, at dapibus tellus erat ullamcorper ligula.</li> </ol> Code:
ol { counter-reset: item; margin-left: 0; padding-left: 0; } li { display: block; font-family: serif; margin-bottom: 0.5em; margin-left: 2em; text-align: justify; } li::before { display: inline-block; font-family: sans-serif; font-weight: bold; color: crimson; content: counter(item) ") "; counter-increment: item; width: 2em; margin-left: -2em; } Below you can check the respective epub. It could be possible to get something that also works under epub2 with old ereaders by using the property "display: inline-block" and creating two blocks (for example one block with a width of 5% for numbers and another block with a width of 90% for the text) but it's more complicated (although possible) to write that. For each paragraph you'll need something like: Code:
<p><span class="block1">1)</span><span class="block2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc. Etiam lobortis, massa ac aliquam auctor, augue nisl sagittis urna, at dapibus tellus erat ullamcorper ligula.</span></p> <p><span class="block1">2)</span><span class="block2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc. Etiam lobortis, massa ac aliquam auctor, augue nisl sagittis urna, at dapibus tellus erat ullamcorper ligula.</span></p> Code:
p { margin: 0 0 1em; } .block1 { display: inline-block; width: 5%; vertical-align: top; padding-right: 1em; text-align: right; font-family: sans-serif; color: crimson; } .block2 { display: inline-block; width: 90%; text-align: justify; font-family: serif; } Last edited by RbnJrg; 11-28-2021 at 07:07 AM. |
|
11-28-2021, 07:58 AM | #15 |
Zealot
Posts: 129
Karma: 48786
Join Date: Oct 2010
Location: Australia - Adelaide
Device: Kindle3
|
RbnJrg - perfect and not complicated! I'm going to play with this...
Thank you very much! |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Converting Epub3 to mobi - TOC becomes numbered list | readerwriter | Conversion | 7 | 10-21-2021 12:59 PM |
Numbered List (ol) Problem w/Sigil v0.9.6 and Kindle | planewryter | Sigil | 9 | 07-18-2016 09:22 PM |
Numbered and bulleted list format lost on Nook Simple Touch epub | Pondering | ePub | 2 | 10-15-2013 09:19 AM |
Are The Days Of The $14.99 Ebook Numbered? | Top100EbooksRank | News | 64 | 01-21-2013 09:23 PM |
Numbered list continuation | bhuvana786 | ePub | 4 | 05-26-2010 01:17 AM |