View Single Post
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,961
Karma: 146918083
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