View Single Post
Old 11-04-2013, 02:05 PM   #12
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Quote:
Originally Posted by RbnJrg View Post
You have two variations:

1. Caption inside the svg image wrapper:

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>
    
    <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
         <text x="33%" y="95%" fill="red">Barak Obama</text>
    </svg> 
  </div> 
</body>
2. Caption outside the svg image wrapper:

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> 

  <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
      <text x="40%" y="20" fill="black">Barak Obama</text>
  </svg> 
</body>
But is not easy to center the text proceding of that way.

Regards
Rubén
The second svg is not really necessary since the x, y can be used to space the text at the bottom of the image or under it. No need for a wrapper. Just size the svg height to more than the image height and it should be fine. Centering is a trial and error approach but the use can specify the length of the line of text and it will been spaced within the length.

Dale
DaleDe is offline   Reply With Quote