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-09-2026, 08:29 PM   #1
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 561
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
CSS compatibility width: fit-content

Is there any chance of getting KOReader to accept the width: fit-content property/value?
ElMiko is offline   Reply With Quote
Old 04-16-2026, 10:25 PM   #2
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 561
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Nothing?

I'm really struggling to understand what CSS elements and properties are compatible with KOReader, and why. I have yet to find a program that reliably gives the user as much control over his/her reading experience as KOReader, but the advanced CSS formatting that it interprets versus that which it ignores is a black box. I understand (and, frankly, align with) the reticence to make KOReader integrate the multimedia elements of ePub3 design, but I am left puzzled by what appears to be an abitrary implementation of modern HTML formatting.

Is there at least any sort of reference guide for what works in KOReader and what doesn't? And what (if any) additional HTML/CSS functionalities are likely to be incorporated?
ElMiko is offline   Reply With Quote
Old 04-17-2026, 07:01 AM   #3
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,822
Karma: 731691
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O, Kobo Libra 2
https://wiki.mozilla.org/QA/Minimal_Test_Cases

fit-content is already supported, so without a minimal testcase there isn't really anything to say.

Quote:
I am left puzzled by what appears to be an abitrary implementation of modern HTML formatting.
The fact that Netsurf is quite similar in end result suggests it's closer to inevitable than arbitrary.

Quote:
Is there at least any sort of reference guide for what works in KOReader and what doesn't? And what (if any) additional HTML/CSS functionalities are likely to be incorporated?
Mainly https://github.com/koreader/crengine...t.cpp#L38-L315

As for what would be added, basically whatever piques someone's interest. Doing preparatory work like providing minimal testcases increases the pique factor.
Frenzie is offline   Reply With Quote
Old 04-17-2026, 08:43 AM   #4
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 561
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by Frenzie View Post
https://wiki.mozilla.org/QA/Minimal_Test_Cases

fit-content is already supported, so without a minimal testcase there isn't really anything to say.
Sorry, the Google AI overview (which we all know has never been wrong) reported that fit-content is not well-supported by KOReader, which seemed to confirm my personal experience, prompting the original post. I've attached a sample epub file with the replicated code that is getting jammed up in KOReader.

The goal is to have a block of text that is centered in the page but with its contents variably aligned within that block, and constrained by the width of its contents [see FitContentCORRECT.jpg].

Unfortunately, in KOReader, it seems to be ignoring the fit-content value and occupying the full width of the screen (excluding the 5% L/R padding). [see FitContentWRONG.jpg]
Attached Thumbnails
Click image for larger version

Name:	FitContentCORRECT.jpg
Views:	39
Size:	42.8 KB
ID:	222621   Click image for larger version

Name:	FitContentWRONG.jpg
Views:	42
Size:	45.6 KB
ID:	222622  
Attached Files
File Type: epub FitContent.epub (2.3 KB, 29 views)

Last edited by ElMiko; 04-17-2026 at 08:46 AM.
ElMiko is offline   Reply With Quote
Old 04-19-2026, 03:58 AM   #5
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,822
Karma: 731691
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O, Kobo Libra 2
It looks like the "correct" screenshot for me. You're most likely using an old version or you've changed some render setting.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20260419_095253.png
Views:	40
Size:	86.9 KB
ID:	222672  
Frenzie is offline   Reply With Quote
Old 04-19-2026, 09:13 AM   #6
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 561
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by Frenzie View Post
It looks like the "correct" screenshot for me. You're most likely using an old version or you've changed some render setting.
Thanks for looking into this @Frenzie.

I updated and now am getting something similar to what your seeing, but it's still not actually "fitting to content". As you can see from your screenshot, the lines are breaking when they shouldn't be—the "padding" is way more than 5% on either side.

EDIT: I think I see what's happening... It's applying the padding after the fit-content, so the content will always render as less than its full width. Presumably, setting the padding to zero and wrapping the whole element in a div with 5% L/R margins will get around this, right?

EDIT2: Okay, so there are two approaches here that would work, I think. One is the div wrap, which would be most useful with absolute value margins (e.g. 2em). The other is a max width property within the blockquote itself, which would be most useful for relative boundaries.

Last edited by ElMiko; 04-19-2026 at 11:03 AM.
ElMiko is offline   Reply With Quote
Old 04-19-2026, 01:29 PM   #7
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,822
Karma: 731691
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O, Kobo Libra 2
More in https://github.com/koreader/crengine...on_r3107195648
Frenzie is offline   Reply With Quote
Old 04-20-2026, 03:29 PM   #8
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 561
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by Frenzie View Post
Okay, interesting; so this was not necessarily intended. I never really know how something is supposed to look because so many html engines have idiosyncratic differences. And to be honest, I'm not even sure that KOReader is doing it "wrong" in any logical sense... every time I try to parse the "fit-content" behavior described, my brain breaks. I know that it defines the padded content a certain way in Sigil, Calibre and Sigil's Page-Edit plugin, while doing it differently in KOReader. What I don't know is which of the two approaches is logically "right." Broadly speaking, is the padding supposed to "push" the boundary out or is it supposed to compress the contents within the boundary?

In any case, do you know if the workarounds would stop working if KOReader were to align itself with the Sigil/Calibre-type rendering? (FWIW, the workarounds also appear to function as desired in Calibre and Sigil, but that's hardly a guarantee of anything.)

EDIT: The two workarounds do seem to work correctly in KOReader currently, too.

Last edited by ElMiko; 04-20-2026 at 04:03 PM.
ElMiko is offline   Reply With Quote
Old 04-21-2026, 05:51 AM   #9
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,822
Karma: 731691
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O, Kobo Libra 2
Quote:
Broadly speaking, is the padding supposed to "push" the boundary out or is it supposed to compress the contents within the boundary?
Normally padding compresses the contents within the boundary, but fit-content specifies that text should go for the max width without overflow before soft-wrapping. I'm not entirely sure how that would interact with padding from a quick glance at the spec though.

Quote:
In any case, do you know if the workarounds would stop working if KOReader were to align itself with the Sigil/Calibre-type rendering?
In principle it shouldn't stop working.

Last edited by Frenzie; 04-21-2026 at 05:54 AM.
Frenzie is offline   Reply With Quote
Old 04-21-2026, 08:20 AM   #10
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 561
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by Frenzie View Post
Normally padding compresses the contents within the boundary, but fit-content specifies that text should go for the max width without overflow before soft-wrapping. I'm not entirely sure how that would interact with padding from a quick glance at the spec though.
Yeah, it appears it creates an order-of-operations paradox, which is probably why the current KOReader rendering and the Sigil/Calibre/Et al. rendering can be internally logically consistent but contradictory to each other.

I'm a little torn now. The Sigil rendering is apparently more commonly adopted, but the KOReader logic is more psychologically soothing. However, I'm fairly confident that the KOR devs didn't conceive of this app with satisfying my mental tics as their principal concern... (and, as per the following paragraph, it appears that my workaround doesn't actually work as well as I'd like, either.)

One note about my workarounds (in case anyone is perversely curious): the <div> wrapper solution doesn't play nice with top/bottom margins defined in percentage values at the blockquote level. Presumably, this has something to do with the div wrapper altering the frame of reference by which that percentage would be calculated, rather than just the height of the page. So perhaps not a perfect solution after all...

Last edited by ElMiko; 04-21-2026 at 03:22 PM.
ElMiko is offline   Reply With Quote
Old 04-22-2026, 03:24 PM   #11
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,822
Karma: 731691
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O, Kobo Libra 2
It'll be fixed in https://github.com/koreader/crengine/pull/662
Frenzie is offline   Reply With Quote
Old 04-23-2026, 08:05 AM   #12
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 354
Karma: 2581190
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on iphone and kindle cloud reader
text containing

It is not widely acceptable yet but calibre's viewer can 'contain' font size and therefore container width in the calibre viewer and the calibre text editor. In the viewer you can vary number of columns with ctrl-[ and ctrl-] and 'uncontained font size' with ctrl-minus and ctrl-plus. The text editor lets you vary 'file preview' with edge dragging and font size with track pad. I don't suppose this works well in ebook readers yet.
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2026-04-23 06-40-35.png
Views:	35
Size:	674.8 KB
ID:	222801   Click image for larger version

Name:	Screenshot from 2026-04-23 06-41-26.png
Views:	30
Size:	755.4 KB
ID:	222802   Click image for larger version

Name:	Screenshot from 2026-04-23 06-41-48.png
Views:	32
Size:	627.0 KB
ID:	222803   Click image for larger version

Name:	Screenshot from 2026-04-23 06-42-19.png
Views:	30
Size:	635.3 KB
ID:	222804  
rjwse@aol.com is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
css if img aspect-ratio >1/1 width:100%, otherwise width:50% rjwse@aol.com Editor 0 03-19-2021 07:41 AM
fit a image to the width of screen leescott ePub 7 07-23-2015 10:39 AM
K3 - Fit to screen (width) for PDF nuke Amazon Kindle 0 09-30-2010 09:27 AM
How to center/fit page width SVG images with <OBJECT> amoroso ePub 0 07-31-2010 11:48 AM
PRS-600 How to make prs600 display PDF fit width? wifish Sony Reader 1 12-20-2009 12:28 PM


All times are GMT -4. The time now is 08:33 AM.


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