![]() |
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 |
I am curious why you believe that would ever work?
|
1 Attachment(s)
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. |
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... |
Quote:
|
Quote:
Also the line height can be set |
Quote:
|
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... |
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.
|
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? |
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... |
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. |
2 Attachment(s)
Karellen
|
5 Attachment(s)
Quote:
1) In your .xhtml file write a normal ordered list (something like): Code:
<ol>Code:
ol {Attachment 190489Attachment 190490Attachment 190491Attachment 190492 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>Code:
p { |
RbnJrg - perfect and not complicated! I'm going to play with this...
Thank you very much! |
| All times are GMT -4. The time now is 08:16 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.