View Single Post
Old 03-06-2017, 12:54 PM   #1
chaot
Head of lunatic asylum
chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.
 
chaot's Avatar
 
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
WANTED: Correct image integration via <img>



I am looking for an easy recipe to embed images (covers & others) into ePubs. It should be Aspect Ratio correct & stabil.

Code:
  <div>

    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 500 751" preserveAspectRatio="none">
      <image width="500" height="751" xlink:href="cover.jpeg"/>
    </svg>

  </div>
This code or similar is very usual - but for me incomprehensible & doesn't fit the requirements.

After much testing I create a very simple code: (looks too simple ).
Works generally fine, but not 100% - and I can't find out why!

Code:
<body>

  <img src="cover.jpeg" max-width="100%" height="100%"/>

</body>
Code:
body {
  font-family: Arial, sans-serif;
  display: block;
  margin: 0;
}
Another way of writing the same code
Spoiler:
Code:
<body>

  <img src="cover.jpeg"/>

</body>

img {
  max-width: 100%;
  height: 100%;
}
chaot is offline   Reply With Quote