View Single Post
Old 05-03-2025, 08:55 AM   #32
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,858
Karma: 8821117
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
If you also want to take into account the ereader in landscape position, use the following code:

1. In your .css file:
Code:
p {
  text-indent: 1.2em; /*change this if you wish */
  text-align: justify; /* change this if you wish */
  font-size: 1em: /* change this if you wish */
  font-family: "Arial", sans-serif; /* change this if you wish */
  margin: 0; /* change this if you wish */
}

h2 {
  font-size: 1.2em; /* change this if you wish */
  text-align: justify; /* change this is you wish */
  -webkit-column-break-before: always !important; /* this is for epub3 */
  page-break-before: always !important; /* this is for epub2 */
  break-before: always !important; /* this is also for epub3 */
}

.container {
  margin: 0; /* change this if you wish */
}

.picture {
  width: 100%;
  height: auto;
  max-height: 50vh; /* You can change this for a higher value if you wish */
}
2. In your .xhtml file:
Code:
  <h2>Your definition</h2>

  <div class="container">
    <svg class="picture" xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMin meet" version="1.1" viewBox="0 0 xxx yyy" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"><image width="xxx" height="yyy" xlink:href="../Images/your_image.jpg"/></svg>
  </div>

  <p>Your text</p>
To generate the <svg> code you have a good Sigil plugin that will do the work for you.

The image need to have and adaptative height, for that reason I give the height to the svg element and not to the div (with a fix height, is better to set the height in the div). Try the code in portrait and landscape mode and you'll understand better how it works.

Last edited by RbnJrg; 05-03-2025 at 09:29 AM.
RbnJrg is offline   Reply With Quote