08-20-2022, 06:03 PM | #1 |
Addict
Posts: 368
Karma: 1000000
Join Date: Mar 2016
Device: none
|
Lithium reader, can't get it to centre headings
I really like Lithium reader, it seems to render most CSS and embedded fonts okay, and it works nicely, but I just can't get it to respect 'text-align: center;' on a h1 tag. Looks like you set all the text to either justified or unjustified and that overrides everything.
Am I doing something wrong? Has anyone been able to centre headings on Lithium? |
08-20-2022, 06:04 PM | #2 |
Resident Curmudgeon
Posts: 77,274
Karma: 138625598
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
We'll need to see samples of the HTML/CSS code.
|
Advert | |
|
08-20-2022, 07:05 PM | #3 |
Addict
Posts: 368
Karma: 1000000
Join Date: Mar 2016
Device: none
|
Pretty standard stuff:
Code:
h1 { font-size: 2em; line-height: 1.5em; font-weight: bold; text-align: center; } |
08-21-2022, 05:47 AM | #4 |
Reading till the spring
Posts: 12,669
Karma: 96845225
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Could be some other CSS messing up.
I just checked one of our books on Lithium, which I use because it seems to respect CSS etc. Also works well with Calibre and/or SD Card. All the centred (center) headings are OK. As an aside, I remove line-height from CSS on any converted ebooks. |
08-21-2022, 08:28 AM | #5 |
Resident Curmudgeon
Posts: 77,274
Karma: 138625598
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
You left out the HTML code. And is there any more CSS that's relevant?
|
Advert | |
|
08-21-2022, 10:40 AM | #6 |
Grand Sorcerer
Posts: 6,236
Karma: 16537336
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Every epub reading app (on eink or Android) I've ever used which offers some kind of option to choose between left align (ragged right) or full-justified uses a broadly similar method to enforce the user's choice.
It's always a small piece of override CSS which looks something like one of the following (in descending order of "aggressiveness"):
The choice of which HTML tags to apply the override to is entirely up to the app developer. Whatever level they choose they will end up delighting some users and upsetting others. Some apps (e.g. KOReader) may give the user a limited choice of how aggressive to be. If Lithium has opted for the most aggressive override, * {text-align:left !important;}, then there is nothing you can do to prevent your <h1> tagged centred text from being forced to text-align:left/justify if you press the left/justify option buttons. The only way to keep them centred is to leave the 'Text align' option set to 'Original'. |
08-21-2022, 11:20 AM | #7 | ||
Addict
Posts: 368
Karma: 1000000
Join Date: Mar 2016
Device: none
|
Quote:
Quote:
|
||
08-21-2022, 11:22 AM | #8 |
Resident Curmudgeon
Posts: 77,274
Karma: 138625598
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
@bookman156 post the entire CSS (in a code block) and the HTML code from the start of the HTML file to the start of the first paragrah (in another code block) so we can have a look and see what's going on.
|
08-21-2022, 11:28 AM | #9 | |
Addict
Posts: 368
Karma: 1000000
Join Date: Mar 2016
Device: none
|
Quote:
Code:
body { font-family: "Dante MT Std", serif; font-weight: normal; color: #000000; margin: 0.5em; widows: 1; orphans: 1; } h1 { font-size: 2em; line-height: 1.5em; font-weight: bold; text-align: center; } p { font-size: 1em; line-height: 1.4em; text-indent: 1em; text-align: left; margin: 0; } p.space { margin-top: 1.2em; } p.first { text-indent: 0; margin-top: 3em; } p.noindent { text-indent: 0; } p.noindentspace { text-indent: 0; margin-top: 1.2em; } /* a space, but still part of previous portion of text */ p.noindentspacebelow { text-indent: 0; margin-bottom: 1.7em; } p.byline { font-size: 1.4em; line-height: 1.5em; margin-top: -0.6em; font-style: italic; text-indent: 0; text-align: center; } p.epigraph { font-size: 1.3em; line-height: 1.4em; margin-top: 1em; text-indent: 0; text-align: center; } em { font-style: italic; } hr.transition { margin: 1.5em 40% 1.55em 40%; border: 0; border-bottom: 1px solid #CCC; } |
|
08-21-2022, 11:31 AM | #10 |
Addict
Posts: 368
Karma: 1000000
Join Date: Mar 2016
Device: none
|
Here's the start of the HTML, from Sigil:
Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <head> <title>Blah blah</title> <link href="../Styles/main.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Blah blah</h1> <p class="byline">Blah blah</p> <p class="epigraph">Blah blah</p> <p class="first">Blah blah.</p> |
08-21-2022, 11:51 AM | #11 |
Addict
Posts: 368
Karma: 1000000
Join Date: Mar 2016
Device: none
|
@Quoth
Just looked at your sample of Under the Stone of Destiny in Lithium and your centred headings are left aligned. That's with unjustified button in Lithium. With justified button they're still not centred, but an attempt at justification, ie massive spaces. I don't see how to look at an epub without one of those two buttons selected. I'm using Lithium 0.24.1 Last edited by bookman156; 08-21-2022 at 11:59 AM. |
08-21-2022, 12:01 PM | #12 |
Reading till the spring
Posts: 12,669
Karma: 96845225
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
I use Lithium on Android because it doesn't overide any CSS.
It displays the same as epub on Kobo or Sony PRS-350 |
08-21-2022, 12:06 PM | #13 |
Reading till the spring
Posts: 12,669
Karma: 96845225
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
The sample I just looked at has this CSS for chapter headings.
It's fine on Lithium on Android 8 and Android 5! Same as full version. The Sample merely has chapter contents snipped on later chapters. .block_12 { display: block; font-family: "Gaelic", serif; font-size: 1.41667em; margin-bottom: 6pt; margin-left: 0; margin-right: 0; margin-top: 22pt; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; text-align: center } 5" phone and 10" tablet. Under Lithium A<cog> option Text Align is "Original" Ver 0.24.1 |
08-21-2022, 12:08 PM | #14 | |
Resident Curmudgeon
Posts: 77,274
Karma: 138625598
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
08-21-2022, 12:10 PM | #15 |
Reading till the spring
Posts: 12,669
Karma: 96845225
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Actually for first item on a page "padding-top" is better than "margin-top".
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Lost the Kobo help centre | Mohan-V-Allied | Kobo Reader | 7 | 08-23-2019 08:46 AM |
How to convert ''Headings'' to ''HEADINGS''? | chaot | Workshop | 13 | 03-16-2017 04:32 PM |
iPad What is the normal temperature operating range for iPad/lithium battery | Alberich | Apple Devices | 5 | 12-14-2012 05:48 PM |
UK's Printed Electronics Technology Centre (PETEC) and the Flexible Display Centre ( | Dulin's Books | News | 0 | 02-18-2010 03:30 PM |
Lithium-Ion battery care | Wetdogeared | Sony Reader | 16 | 12-02-2008 09:52 PM |