Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-16-2021, 03:03 PM   #1
what
Enthusiast
what began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Mar 2021
Device: none
Do SVGs have to be wrapped in DIVs?

Most sample code shows SVG in ePub wrapped in DIVs, e.g. for a full page image:

Code:
<div>
    <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" preserveAspectRatio="xMidYMid meet" viewBox="0 0 783 1200" xmlns:xlink="http://www.w3.org/1999/xlink">
        <image width="783" height="1200" xlink:href="../Images/cover.jpg" />
    </svg>
</div>
A few questions:
  1. Is such a wrapper necessary?
  2. Is it necessary both for full page and for inline images?
  3. Is it necessary also if the SVG doesn't contain a pixel image but only vector code?
  4. Does the wrapper have to be styled in any way?
what is offline   Reply With Quote
Old 03-16-2021, 04:25 PM   #2
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
EPUBCHECK does not have any problem with <svg> being used as a child of <body>. As far as I know there is no reason to wrap an inline SVG image within a <div>.
jhowell is offline   Reply With Quote
Old 03-16-2021, 06:26 PM   #3
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
AFAIR, epub2 required a wrapper around the SVG but that seems to have dropped in epub3.
DNSB is offline   Reply With Quote
Old 03-23-2021, 02:40 AM   #4
what
Enthusiast
what began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Mar 2021
Device: none
As I found out, the specifications may not require a wrapper around an image, but if you want to center an image on devices like the Kindle, you may need to wrap the image in something like a paragraph (<P>) that allows you to apply "text-align:center" to the contained image.
what is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
nesting divs & spans AlanHK ePub 7 11-20-2018 06:25 AM
Rogue Space appearing above floating divs verydeepwater ePub 0 06-07-2014 07:08 AM
SVGs are centered by KF8, how do you prevent it? FunkeXMix Kindle Formats 3 01-09-2013 07:32 PM
ePub (and KF8) from SVGs heinrich66 ePub 5 05-03-2012 01:56 PM
Pasting creates DIVS but not Paragraphs? bitterbug Sigil 4 10-22-2010 12:42 AM


All times are GMT -4. The time now is 12:53 PM.


MobileRead.com is a privately owned, operated and funded community.