Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 04-16-2023, 05:12 AM   #1
sHiN3
Member
sHiN3 began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Apr 2010
Device: Kindle Oasis 3, Boox Leaf, Kobo Libra 2
Keep portrail image with caption in one page?

I'm using KOReader on a Kobo Libra 2. For Epub has images and captions right under them, I've set image "width: 90%" to make it appear larger in KOReader. It looks fantastic with landscape images, because there are usually lots of spaces under the image.

If, for example, the resolution of the portrail image is "500 x 1600px", KOReader will override "windth: 90%" and fit the image with height instead, then the caption will be on the next page.

I'm currently using a div wrapper with a "bottom-margin" of 2em to display at least one line of the caption.

I'm curious whether there's a way to retain the portrail image and entire caption on one page with image "width: 90%".

I post it here because different devices / apps treat image style differently, and KOReader is my primary app.

here is the HTML code and CSS style I'm using:

Code:
  <div class="img-wrap">
    <img alt="200" src="../Images/500x1600.jpg"/> 

    <div class="img-caption">
      This is a super super super super super super super super super super super super super super long long long long long long long caption.
    </div>
Code:
div.img-wrap {
  page-break-inside: avoid;
  text-align: center;
  display: block;
  margin: 0.5em auto 2em;
}

div > img {
  width: 90%;
  margin: 0 auto;
}

div.img-caption {
  width: 90%;
  font-size: 80%;
  margin: 0.1em auto;
}
sHiN3 is offline   Reply With Quote
Old 04-16-2023, 05:48 AM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,613
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Maybe this?... https://developer.mozilla.org/en-US/...Element/figure

Spoiler:
PHP Code:
    <figure class="centre">
    
      <
img src="../Images/stepper.jpeg" alt="Stepper Diagram" style="width:80%"/>
      <
figcaption class="centre">The plan for Willis Linsay’s original ‘Stepper’ as anonymously posted online<br/><small>(please notethe publisher accepts no responsibility for the inappropriate use of this diagram or the technology it represents.)</small></figcaption>

    </
figure

Last edited by Karellen; 04-16-2023 at 05:56 AM. Reason: Add example code
Karellen is offline   Reply With Quote
Old 04-16-2023, 07:32 AM   #3
sHiN3
Member
sHiN3 began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Apr 2010
Device: Kindle Oasis 3, Boox Leaf, Kobo Libra 2
Thanks for your reply.

Unfortunately, it doesn't work, the caption is on the next page.



Quote:
Originally Posted by Karellen View Post
Maybe this?... https://developer.mozilla.org/en-US/...Element/figure

Spoiler:
PHP Code:
    <figure class="centre">
    
      <
img src="../Images/stepper.jpeg" alt="Stepper Diagram" style="width:80%"/>
      <
figcaption class="centre">The plan for Willis Linsay’s original ‘Stepper’ as anonymously posted online<br/><small>(please notethe publisher accepts no responsibility for the inappropriate use of this diagram or the technology it represents.)</small></figcaption>

    </
figure
sHiN3 is offline   Reply With Quote
Old 04-16-2023, 11:12 AM   #4
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,751
Karma: 730681
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
I don't think you can do that in KOReader, but you could come close by setting something like (max-)height: 80vh on the image.
Frenzie is offline   Reply With Quote
Old 04-17-2023, 02:30 AM   #5
sHiN3
Member
sHiN3 began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Apr 2010
Device: Kindle Oasis 3, Boox Leaf, Kobo Libra 2
Quote:
Originally Posted by Frenzie View Post
I don't think you can do that in KOReader, but you could come close by setting something like (max-)height: 80vh on the image.
Thanks!!

I don't know this VW/VH unit before.

After deleting "width: 90%" from my previous CSS and replacing it with "height: 70vh," I got landscape images that fit to the width and portrait images that fit 70% of the screen, with adequate space for caption.

Best workaround at the moment!
sHiN3 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
join (image + caption) and fill page AlanHK ePub 4 04-04-2015 05:23 PM
keeping image and caption together whbenson ePub 0 08-20-2013 06:19 PM
How to be sure a full page image+ caption is not split between 2 pages? silviolorusso ePub 9 07-12-2013 08:24 PM
L shape image with caption? LostSock ePub 5 09-08-2011 07:24 PM
Center Image and Caption SamL ePub 11 08-12-2011 09:27 AM


All times are GMT -4. The time now is 01:28 AM.


MobileRead.com is a privately owned, operated and funded community.