View Single Post
Old 11-04-2013, 08:44 AM   #5
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,801
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by GrannyGrump View Post
I am having trouble beating this into my weary brain. Sometimes it feels like the W3C site is speaking Greek, and I ain't Greek.

I've been using svg wrappers for just the image for quite a while. Now I want to try adding a caption.

Would someone be so kind as to post a code example of a simple svg wrapper (with png or jpg image) that has a simple caption at the bottom?

I don't want to get into rotating or any of the other Mardi Gras stuff right now


I'll even save some of my Halloween candy for you
Hi Granny;

In your .css stylesheet, write the following:

Code:
html {
    height: 100%;
    margin: 0;
}

body {
    height: 100%;
    margin: 0;
}

#container {
    height: 85%;
}

.img_caption {
    height: 15%;
    text-align:center;
    margin-top: 10px;
    font-weight: bold;
}

p {
    text-align: justify;
    text-indent: 1em;
    font-size: 1em;
    margin-bottom: 1em;
}
And in your .html file write this code:

Code:
<body>
  <div id="container">
    <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 248 310" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink">
      <image height="310" width="248" xlink:href="../Images/Obama.jpg"></image>
    </svg>
  </div>

  <div class="img_caption">
    Barak Obama<br />
    President of the United States of America
  </div>
</body>
Of course, you'll have to adapt the viewBox of your SVG wrapper according to your image. Also take in count that the height of the id "container" plus the height of the class "img_caption" must be equal to 100%. This solution is not so perfect as my solution for the .kf8 format but this one works in ADE

Below I attach screenshots on my ADE and the respective ePub.

Regards
Rubén
Attached Thumbnails
Click image for larger version

Name:	Obama1.jpg
Views:	424
Size:	52.7 KB
ID:	114642   Click image for larger version

Name:	Obama2.jpg
Views:	391
Size:	68.7 KB
ID:	114643  
Attached Files
File Type: epub Image & Caption for ADE.epub (17.9 KB, 267 views)
RbnJrg is offline   Reply With Quote