Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 10-21-2023, 03:55 AM   #1
jugaor
Enthusiast
jugaor began at the beginning.
 
jugaor's Avatar
 
Posts: 30
Karma: 10
Join Date: Jun 2011
Location: Lima, Peru
Device: Kindle 10Gen / Kobo Aura HD / Nook STR
Issues with specificity (epub > azw3)

Hello.

For a while now I've been using the "Single file solution for full-screen images with captions" method from here:
https://github.com/jstallent/ImagesSingleFile
which basically is to use two types of measures for images (percentage and viewport).
Code:
.image1 img {
   height: 85%;
}
.image1 img:only-of-type {
   height: 85vh;
}
Devices/apps with only CSS2 support will use the first and those with CSS3 will use the second, so they will always display the image with the correct height.

However, placed like this, the Calibre conversion to azw3 takes the last measure (viewport), which Kindle doesn't recognize.
If we invert them, everything is fine (it takes the last one, percentage this time):
Code:
.image1 img:only-of-type {
   height: 85vh;
}
.image1 img {
   height: 85%;
}
That is: Calibre seems to not respect the higher specificity of the pseudo-class, only the order of classes within the css (or I'm doing something wrong…?).

So far, the latter way has worked fine for me, both in epubs and converted azw3s (and thus avoids adding an extra @media amzn-kf8).
I would like to know if this behavior is as expected or if it could change in the future…

An idea: if both measurements are found and the conversion is for Kindle, could Calibre automatically discard viewport and use percentage?

Thanks in advance (and sorry for my terrible English).



[Calibre 6.29.0, Windows 11-64bits, default conversion options (I think).
I'm attaching the test epub, the converted azw3 and the log.]
Attached Files
File Type: epub only-of-type - Test.epub (81.0 KB, 22 views)
File Type: azw3 only-of-type - Test.azw3 (98.2 KB, 21 views)
File Type: txt Calibre_log.txt (4.2 KB, 23 views)
jugaor is offline   Reply With Quote
Old 10-21-2023, 04:41 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just use svg it has worked well on all devices for over a decade. No need to try and get overly clever with css. calibre conversion uses the specificity that comes from the css_parser (fork of cssutils) python library, so you would need to check there.

See https://manual.calibre-ebook.com/con...ormatting-demo for an demo epub file which shows you how to do full screen images with text
kovidgoyal is offline   Reply With Quote
Old 10-21-2023, 05:09 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
And that's the fix for css-parser: https://github.com/ebook-utils/css-p...ded44ad99d2ddf
kovidgoyal is offline   Reply With Quote
Old 10-21-2023, 07:13 AM   #4
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,171
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Never use vh.
Quoth is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two issues with EPUB->AZW3 conversion: Cover in TOC and Start/Begin Zillion_ Conversion 1 07-30-2023 03:24 PM
(Solution) Formatting issues converting from azw3 to epub SillyStegosaurus Conversion 29 07-27-2023 03:36 PM
AZW3 and PDF issues olbeggaols Kobo Reader 6 05-05-2021 03:05 PM
epub to azw3 conversion formatting issues topquark Conversion 45 07-31-2014 05:28 AM
azw3 to epup issues shentar Conversion 10 07-16-2014 05:50 AM


All times are GMT -4. The time now is 03:07 AM.


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