View Single Post
Old 08-17-2012, 04:58 AM   #11
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by eggheadbooks1 View Post
I tried coding it like this:

Code:
<div class="sgc-2" style="max-width:293px; max-height:333px">
but Sigil then changes each style to a div.sgc and I end up with this

Code:
<div class="sgc-2 sgc-3">
whereby sgv 3 is

Code:
div.sgc-3 {max-width:293px; max-height:333px}
That's OK, both things mean the same and should be rendered the same.

Your problem is that you don't want centering, but auto margins. Centering, as a text-align value, refers to the alignment of content inside the <div>, but it doesn't specify how the whole <div> will be placed in the page (or screen, or other containing block). That would be done by adding "margin-left: auto; margin-right: auto;" to the sgc-3 style, but readers are allowed to ignore auto margins (and Adobe does).

There are some things you could try, one of them is this, that you already tried:

Code:
<div class="sgc-2">
   <div class="sgc-3">
    <svg xmlns="http://www.w3.org/2000/svg" height="100%" max-width="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 293 333" xmlns:xlink="http://www.w3.org/1999/xlink">
      <image height="333" width="293" xlink:href="../Images/Angel72.jpg"></image><br />
    </svg>
   </div>
</div>
(remove that <br/>, it's not doing any good, I'm not even sure it's allowed in SVG)

But add "display: inline" to the sgc-3 style. Normally a <div> is "display: block", which is rendered as a "paragraph", ignoring text-align, with "display: inline" you make it behave as "character" (of whatever size), and it should obey text-align.

Or you could skip a level and go with:

Code:
<div class="sgc-2">
    <svg style="max-width:293px; max-height:333px" xmlns="http://www.w3.org/2000/svg" height="100%" max-width="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 293 333" xmlns:xlink="http://www.w3.org/1999/xlink" >
      <image height="333" width="293" xlink:href="../Images/Angel72.jpg"></image>
    </svg>
</div>
That is, set the maximum size for the <svg> element directly (again, it works in Opera). You could also try with class="sgc-3" instead. I'm not quite sure this is really compliant, but nothing is lost trying.
Jellby is offline   Reply With Quote