![]() |
#1 |
Member
![]() 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; } |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,613
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Last edited by Karellen; 04-16-2023 at 05:56 AM. Reason: Add example code |
![]() |
![]() |
![]() |
#3 | |
Member
![]() 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:
|
|
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#5 | |
Member
![]() Posts: 13
Karma: 10
Join Date: Apr 2010
Device: Kindle Oasis 3, Boox Leaf, Kobo Libra 2
|
Quote:
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! |
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |