![]() |
#1 |
Connoisseur
![]() Posts: 61
Karma: 10
Join Date: May 2025
Device: iPad
|
Is it Safe to Use height: 100vh?
In some cases I wanna center images vertically on a single page. For that reason I set page-break-before and after on the container and center the image via flex.
HTML Code:
<div class="single-page v-center"> <figure> <img src="../images/aloha.png"/> </figure> </div> Code:
.single-page { -webkit-column-break-before: always; page-break-before: always; break-before: always; -webkit-column-break-after: always; page-break-after: always; break-after: always; } .single-page.v-center { display: flex; justify-content: center; align-items: center; height: 100vh; } Also, I've noticed that Thorium (at least the version I'm running) doesn't recognize the page-break properties, but still uses the full 100vh for the conainer, which results in a container with the expected height but the container is split into two parts over two pages, while the image itself is put on the second page, overlaying text which is not nudged bottomwards. The space reserved is correct with 100vh, but it's not reserved on a single page, while the image is then taken out of the flow and put onto the second page. Really bad. However, all other reader I've tested (Google, Apple, Calibre, PocketBook) seem to work well. I'm grateful for any opinion on that. Thanks |
![]() |
![]() |
![]() |
#2 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
It's not a good idea to with hv or wv if you want ePub2 compatibility. If you don't care about ePub2 compatibility, you can use vh and vw,
Last edited by JSWolf; 07-12-2025 at 04:43 PM. |
![]() |
![]() |
![]() |
#3 | |
Connoisseur
![]() Posts: 61
Karma: 10
Join Date: May 2025
Device: iPad
|
Quote:
Btw, is that a typo in your answer with hv and wv, or are these proper units? |
|
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
You don't need page-breaks if you work under epub3; watch the attached epub. Try to increase/decrease the font-size to see what happens.
Last edited by RbnJrg; 07-12-2025 at 03:15 PM. |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
![]() |
![]() |
![]() |
#6 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
.height { height: 100%; height: 100vh; } Last edited by JSWolf; 07-12-2025 at 04:46 PM. |
|
![]() |
![]() |
![]() |
#7 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#8 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,010
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
|
![]() |
![]() |
![]() |
#9 | ||
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,347
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Yes, he could just use 2 css sheets.
I think JSWolfe's understanding of CSS is tainted by his experience with ADE. He thinks that the use of anything not understood/supported will cause the entire css sheet to be ignored, instead of just that portion that is not understood/supported. That is a valid concern under ADE but it is not a CSS issue. The portion below in red is an ADE issue not a css issue. Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#10 |
Connoisseur
![]() Posts: 89
Karma: 10
Join Date: Dec 2024
Device: Tolino Shine 5
|
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
That is because ADE 4 has two rendering engines: the old RMSDK to render epub2 and a Readium derivative for rendering epub3. That's why epub2 renders look the same in both ADE 2.x/3.x and ADE 4.x.
|
![]() |
![]() |
![]() |
#12 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Also, using 2 style sheets will not always work. Not every ePub3 compatible program supports Javascript. So you have to treat your ePub like the program being used don't do Javascript. Last edited by JSWolf; 07-13-2025 at 03:23 PM. |
|
![]() |
![]() |
![]() |
#13 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,759
Karma: 5706256
Join Date: Nov 2009
Device: many
|
For the record, which true epub3 ereaders do not support even basic javascript?
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
By the way, the OP could try using not only "vh" but also "svh" or "dvh" (for example, Sigil and its plugins, Thorium, Calibre Viewer, accept those units). Regarding units viewport there are much more than vh and wh:
https://www.terluinwebdesign.nl/en/b...h-svw-lvw-dvw/ https://caniuse.com/?search=svh These new sv* units are especially useful for Android and iOS e-readers. One could try a style with: Code:
.myHeight { height: 100vh; } @supports (height: 100svh) { .myHeight { height: 100svh; } } |
![]() |
![]() |
![]() |
#15 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Image height | JSWolf | KOReader | 6 | 03-29-2021 04:29 PM |
Picture height | senhal | ePub | 6 | 12-31-2018 03:07 PM |
line height | Rellwood | Conversion | 3 | 04-07-2018 04:34 AM |
EuGH zu Safe Haven USA: Not safe enough. | beachwanderer | Deutsches Forum | 0 | 10-06-2015 04:25 AM |
Max-Height | theducks | Sigil | 6 | 09-02-2010 05:40 PM |