05-26-2023, 08:49 AM | #1 |
Junior Member
Posts: 6
Karma: 10
Join Date: Mar 2023
Device: none
|
Nested Lists Not Working for ePubs
Hello! I hope everyone is having a great day.
I'm having an issue trying to create nested lists in epubs. This is not for a nav or toc.xhtml document, but rather, appears in the running text of the book. For example, I want a nested list in the <body> tag of chapter01.xhtml: Code:
<ul> <li>First item</li> <ul> <li>First item Quality A</li> <li>First item Quality B</li> </ul> <li>Second item</li> <ul> <li>Second item Quality A</li> <li>Second item Quality B</li> </ul> </ul> "Error while parsing file: element "ul" not allowed here: expected the element end-tag or element "li", "script", or "template" switching to <ol> tags doesn't work, and in any case, not what I want (I don't want a numbered list, but bulleted). It seems only <li> are allowed within <ul> or <ol> tags. I tried searching on google for nesting lists for epubs, but it doesn't seem to be a common problem? What am I doing wrong? Thank you in advance! |
05-26-2023, 09:33 AM | #2 |
Sigil Developer
Posts: 7,734
Karma: 5444398
Join Date: Nov 2009
Device: many
|
Your knowledge of how to nest is incorrect (but does work in all browsers I have tested!).
To see it properly done take a look at how nesting is done in the nav. Or try this shortened snippet based on your above. The second level ul is actually nested inside the first li tag because the nested list belongs to that list item. Code:
<ul> <li>First item <ul> <li>First item Quality A</li> <li>First item Quality B</li> </ul> </li> <li>Second item</li> </ul> See https://stackoverflow.com/questions/...ml-nested-list And: https://developer.mozilla.org/en-US/...#nesting_lists Last edited by KevinH; 05-26-2023 at 09:40 AM. |
05-26-2023, 09:46 AM | #3 |
Junior Member
Posts: 6
Karma: 10
Join Date: Mar 2023
Device: none
|
Oh my gosh it worked. I feel so silly now for not realizing that I need to nest the second <ul>/<ol> within a <li> tag. Thank you so much for explaining to me! Have a lovely day
|
05-26-2023, 10:19 AM | #4 |
A Hairy Wizard
Posts: 3,119
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
That is how I get it to work as well… although IIRC epubcheck throws fits with nesting it that way??? I haven’t tried it in awhile, it may have been fixed with the latest epubcheck update.
|
05-26-2023, 10:25 AM | #5 |
Resident Curmudgeon
Posts: 74,604
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
The code posted in the 1st post does throw errors with the latest epubcheck.
|
05-26-2023, 10:30 AM | #6 |
Resident Curmudgeon
Posts: 74,604
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
If you were to use Calibre's Editor or Sigil, you could install the epubcheck plugins. That way if you do find any errors, it would be a lot easier to fix them as you can click on the error and be taken to the line that has the error to then fix.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Google Play Books and Nested Lists - Some Weird Display Issue | rsuchwani | ePub | 80 | 10-10-2021 03:08 PM |
Automatically Fixing Nested Lists | Rand Brittain | Editor | 2 | 09-06-2017 06:58 PM |
Nested lists with paragraphs | sdm1130 | Kindle Formats | 4 | 11-22-2011 06:32 PM |
Nested Ordered Lists | andyd273 | Conversion | 9 | 11-17-2011 12:05 PM |
Classic Nook Nested Lists | ldespain | Barnes & Noble NOOK | 0 | 08-08-2011 04:06 PM |