11-18-2018, 12:44 AM | #1 | |
Guru
Posts: 674
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
nesting divs & spans
I was looking at an epub converted by Calibre.
Cleaning it up I ran epubcheck and found it warning on numerous lines: Quote:
Obviously this is awful spaghetti code, but I thought it was at least valid. Code:
<div class="calibre14"> <span class="calibre15"> <div class="calibre11"> <span class="calibre9">ABC<br class="calibre11"/> </span> </div> DEF </span> </div> |
|
11-18-2018, 04:39 AM | #2 |
Grand Sorcerer
Posts: 5,636
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
<div> is a block-level element that can contain pretty much any other element. OTOH, <span> is an inline element that can contain only other inline elements.
|
Advert | |
|
11-18-2018, 06:22 AM | #3 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
|
11-18-2018, 07:42 AM | #4 |
Grand Sorcerer
Posts: 27,947
Karma: 198500000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Always remember that Sigil's Well Formed check is not a specification checker/validator. It merely checks to see if all open tags are closed and that there are no nesting errors (meaning improper overlap of tags--no block-level/inline rules of xhtml are checked}. It's not an exhaustive, rule-based validation routine at all. It's a down & dirty check that nothing egregious is happening. That nothing is going to prevent Sigil from safely saving the epub, and that Sigil's automated routines can be safely run. Use a spec validator plugin if you want to know if an epub is spec-compliant.
|
11-18-2018, 01:04 PM | #5 | |
Guru
Posts: 674
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
I mentioned other things that did not complain, not just the WFC. It's just that epubcheck seems to be the only thing that is bothered by this non-compliance. Despite being horrible code, it displays perfectly well in iBooks, for instance. But I'll try to fix it just to shut epubcheck up, makes it hard to see other errors when it blurts 50 warnings about this when I do a check. |
|
Advert | |
|
11-18-2018, 04:16 PM | #6 |
Grand Sorcerer
Posts: 27,947
Karma: 198500000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
There's tons of stuff that epubcheck (and a w3c xhtml check) barks at that "looks OK" in most renderers. That's because most display engines tend to be more forgiving than the specs that (attempt to) govern the markup they're tasked with rendering.
Last edited by DiapDealer; 11-18-2018 at 04:19 PM. |
11-18-2018, 09:49 PM | #7 |
Well trained by Cats
Posts: 30,397
Karma: 58055234
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I think of a span as 'adjusting' part of the block (bold, italic, bigger, smaller), but it is always part of a single block.
OTOH I use Div as more of a 'grouping container' for P or H type blocks I know, some folk use Div instead of P I also use Blocquote instead of a Div in most cases. Why not? Unless you need a non-standard exception. |
11-20-2018, 06:25 AM | #8 | |
A Hairy Wizard
Posts: 3,204
Karma: 19000001
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Empty Spans for iBooks compatibility | JSWolf | Workshop | 24 | 12-19-2015 01:46 PM |
Rogue Space appearing above floating divs | verydeepwater | ePub | 0 | 06-07-2014 07:08 AM |
No class <spans> | dynabook | ePub | 5 | 11-02-2012 10:42 AM |
Kindle Life Spans | sirmaru | Amazon Kindle | 11 | 12-24-2011 12:31 PM |
Pasting creates DIVS but not Paragraphs? | bitterbug | Sigil | 4 | 10-22-2010 12:42 AM |