Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 02-08-2023, 12:06 PM   #1
twowheels
Wizard
twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.
 
twowheels's Avatar
 
Posts: 1,853
Karma: 13432974
Join Date: Nov 2010
Device: Kobo Clara HD, iPad Pro 10", iPhone 15 Pro, Boox Note Max
These uncentered section breaks are driving me nuts…

It’s probably a bit extreme to be so bothered by this, but it is bothering me.

I assume that this is the crengine’s doing, and maybe it’s because of the odd number of characters, but is there any way to improve this centering? Maybe I can add some custom css?


https://imgur.com/a/OesiJCY
twowheels is offline   Reply With Quote
Old 02-08-2023, 12:22 PM   #2
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Pretty sure the "center" class is missing a "text-indent: 0", so it has some (default or inherited) indent.
Jellby is offline   Reply With Quote
Advert
Old 02-08-2023, 03:06 PM   #3
twowheels
Wizard
twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.
 
twowheels's Avatar
 
Posts: 1,853
Karma: 13432974
Join Date: Nov 2010
Device: Kobo Clara HD, iPad Pro 10", iPhone 15 Pro, Boox Note Max
Interesting observation — I might try some custom CSS on the center class to see if I can improve that — or a negative indent as there doesn’t seem to be much else centered in this book.
twowheels is offline   Reply With Quote
Old 02-08-2023, 03:33 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,750
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Try the following CSS code. It should work.

Code:
.sectionbreak {
margin-top: 0.8em;
margin-bottom: 0.8em;
text-align: center;
text-indent: 0;
}
JSWolf is offline   Reply With Quote
Old 02-08-2023, 05:38 PM   #5
twowheels
Wizard
twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.
 
twowheels's Avatar
 
Posts: 1,853
Karma: 13432974
Join Date: Nov 2010
Device: Kobo Clara HD, iPad Pro 10", iPhone 15 Pro, Boox Note Max
Quote:
Originally Posted by JSWolf View Post
Try the following CSS code. It should work.

Code:
.sectionbreak {
margin-top: 0.8em;
margin-bottom: 0.8em;
text-align: center;
text-indent: 0;
}
Doesn’t that assume that there’s already a CSS class named sectionbreak? I don’t see that in the HTML that I took a picture of. That said, I’m a C++ developer and don’t do much with CSS, so maybe I’m missing something really obvious.
twowheels is offline   Reply With Quote
Advert
Old 02-08-2023, 05:58 PM   #6
twowheels
Wizard
twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.
 
twowheels's Avatar
 
Posts: 1,853
Karma: 13432974
Join Date: Nov 2010
Device: Kobo Clara HD, iPad Pro 10", iPhone 15 Pro, Boox Note Max
So, I changed p.center to be left aligned and it was not quite left aligned, no matter how I tried to play with margin/border/padding, whether explicit zero values or reset/unset. I did find, though, that if I used the HTML5 (html5.css) built-in style instead of the HTML/EPUB (epub.css) that it centers much closer to where I’d expect it to be. I’ll review those two CSS files when I get time and access to a real computer, but it looks like it’s something in the KOReader CSS files that’s doing this.
twowheels is offline   Reply With Quote
Old 02-09-2023, 06:12 AM   #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,751
Karma: 730681
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Quote:
Originally Posted by twowheels View Post
Doesn’t that assume that there’s already a CSS class named sectionbreak? I don’t see that in the HTML that I took a picture of. That said, I’m a C++ developer and don’t do much with CSS, so maybe I’m missing something really obvious.
I think that's intended as "yourclassnamehere".
Frenzie is offline   Reply With Quote
Old 02-09-2023, 09:48 AM   #8
twowheels
Wizard
twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.twowheels ought to be getting tired of karma fortunes by now.
 
twowheels's Avatar
 
Posts: 1,853
Karma: 13432974
Join Date: Nov 2010
Device: Kobo Clara HD, iPad Pro 10", iPhone 15 Pro, Boox Note Max
OK, I figured it out by cloning the github repo and looking through the css files.

In epub.css (unlike html5.css) I found this:

Code:
/* Block elements */
p {
    text-indent: 1.2em;
    margin-top: 0;
    margin-bottom: 0;
}
So, it seems that it's text-indent that's causing it. So, I put in a book-specific style tweak that says:

Code:
p.center {
  text-indent: 0;
}

...and it's now properly centered.

I'm wondering whether this is something that should be in the global css file, or whether the text-indent should be removed from the global paragraph style -- I mean, coolreader base already handles margins, right?

As a follow-up test, as I was typing this, I changed the above p.center to just p in my book-specific style tweak and the dots stayed centered and I didn't see any change to the margins, so I'm even more inclined to believe that the text-indent should just be removed from the global paragraph style.
twowheels is offline   Reply With Quote
Old 02-09-2023, 10:15 AM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,750
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
delete post

Last edited by JSWolf; 02-09-2023 at 10:19 AM.
JSWolf is offline   Reply With Quote
Old 02-09-2023, 10:18 AM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,750
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by twowheels View Post
OK, I figured it out by cloning the github repo and looking through the css files.

In epub.css (unlike html5.css) I found this:

Code:
/* Block elements */
p {
    text-indent: 1.2em;
    margin-top: 0;
    margin-bottom: 0;
}
So, it seems that it's text-indent that's causing it. So, I put in a book-specific style tweak that says:

Code:
p.center {
  text-indent: 0;
}

...and it's now properly centered.

I'm wondering whether this is something that should be in the global css file, or whether the text-indent should be removed from the global paragraph style -- I mean, coolreader base already handles margins, right?

As a follow-up test, as I was typing this, I changed the above p.center to just p in my book-specific style tweak and the dots stayed centered and I didn't see any change to the margins, so I'm even more inclined to believe that the text-indent should just be removed from the global paragraph style.
That's not correct. you would lose indents for <p> and that means you would need to do <p class="somedumbuneededclass"> to get indents. It's best to just use <p>. Every class with a center should have a text indent of 0. It's good programming.
JSWolf is offline   Reply With Quote
Old 02-09-2023, 01:53 PM   #11
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
c.f., the links in https://github.com/koreader/koreader...ent-1423005535 for the reasoning .
NiLuJe is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Driving me nuts, lol ePub tocs markx2 ePub 16 12-24-2013 11:26 AM
Driving me nuts, lol markx2 Sigil 1 12-06-2013 01:35 AM
Kindle driving me nuts lateralex Devices 4 02-29-2012 11:36 PM
Ralph Ellison is driving me nuts! loltun Amazon Kindle 18 07-10-2011 09:10 AM
This is driving me nuts... Spit Calibre 16 09-04-2009 02:03 AM


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


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