Thread: Image height
View Single Post
Old 03-29-2021, 12:52 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 80,034
Karma: 147977995
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Jellby View Post
Does KOReader support "display: grid"? If so, one could try something like this (works nicely on Firefox):

Code:
@supports (display: grid) {
  .illustration {
    display: grid;
    grid-template: "image" minmax(0,max-content) "caption" min-content;
    height: 100vh;
    width: 100%;
    margin: 0 auto;
  }
  .illustration .image {
    grid-area: image;
  }
  .illustration .caption {
    grid-area: caption;
    font-size: 80%;
    padding-top: 0.5em;
  }
}
Code:
<div class="illustration">
<span class="image"><span><img src="image.jpg" alt=""/></span></span>
<span class="caption">Blah blah blah</span>
</div>
(I'm not sure the <span> inside <span class="image"> is needed, but I must have it for a reason.)

The idea is that it should work with multi-line captions too, and the whole image+caption should take 100%.
The code does not work in Sigil or KOReader. The solution was given in the post before yours.
JSWolf is offline   Reply With Quote