03-02-2018, 10:47 AM | #1 |
Member
Posts: 13
Karma: 10
Join Date: Feb 2018
Device: Kobo Glo
|
Force text alignment
Hello,
When I change the bodytext from justify to left-aligned on my Kobo Glo, everything that is center- or right-aligned becomes left-aligned too (accept for headers). Is there a way to force the alignment of those paragraphs without changing them all manually in html by adding style="text-align:center;"? |
03-02-2018, 12:39 PM | #2 |
A Hairy Wizard
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
You will need to do some work in your CSS file. How much work depends on how well the epub was set up originally.
Look for something similar to: p {text-align:justify} and change it to: p {text-align:left} Hopefully, it is a clean document and you will only need to change it the one time... BTW, what you want to do is exactly why it is beneficial to have a clean CSS sheet, with clean HTML tags. One minor change can fix the whole document! FWIW here is an example of what I'm talking about: Spoiler:
|
Advert | |
|
03-02-2018, 01:40 PM | #3 | |
Member
Posts: 13
Karma: 10
Join Date: Feb 2018
Device: Kobo Glo
|
Quote:
What if I want the bodytext to be justified because I have other parapgraphs that are left-aligned. I want there to be a clear distinction between those and the bodytext. If whomever should read it, chooses to change the alignment of the bodytext at his/her own accord, that's ok! But I don't want the center- and right- aligned paragraphs to become left-aligned as well. |
|
03-02-2018, 02:23 PM | #4 |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Actually, there is a much easier way to sort the alignment.
In the CSS, delete all occurrences of text-align: left and text-align: justify. Next, put the justify you want in the body CSS style and if one doesn't exist, add one. body { text-align: justify; } or body { text-align: left; } That will make it how you want. And if you change your mind, it's very easy to just change the alignment in CSS. |
03-03-2018, 07:41 AM | #5 | |
Member
Posts: 13
Karma: 10
Join Date: Feb 2018
Device: Kobo Glo
|
Quote:
So, is there a way to force the alignment of those paragraphs (the paragraphs that are NOT justified) without changing them all manually in html by adding style="text-align:center;"? Last edited by HHJT; 03-03-2018 at 07:49 AM. |
|
Advert | |
|
03-03-2018, 10:43 AM | #6 | |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
03-03-2018, 11:28 AM | #7 |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
What firmware are you running? I'm running 4.7.10413 and I just tested the justification with ePub and kepub and centered paragraphs did not become left or full justified. I don;t know what your problem is other than maybe an older firmware where this is a bug. It's not a bug in the latest firmware.
Last edited by JSWolf; 03-03-2018 at 11:49 AM. |
03-09-2018, 06:00 PM | #8 | |
Member
Posts: 13
Karma: 10
Join Date: Feb 2018
Device: Kobo Glo
|
Quote:
I always use Calibre to upload my ebooks. Maybe that was part of the problem? So I tried ADE: everything stays in place… but the bodytext stays justified as well. I can't left-align. And I can't change the line-height. |
|
03-09-2018, 08:09 PM | #9 | ||
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Quote:
For epubs, it doesn't matter how the book got on the device. They will be the same whether it is ADE, calibre or a manual sideload. If you are seeing differences, it is because the books are different, not the method of sideloading. The rules are different for kepubs. I don't sideload these enough to really know what the rules are. Plus, I always removed the justification styles from my books except for the styles that need them. And when I read a purchased kepub, I have to accept what is in the book for the styles. |
||
03-09-2018, 08:13 PM | #10 |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I do the same as davidfor and remove all justification except center and justify (in the body). I prefer the CSS to be simple. I also remove all that excess CSS that most publishers put in. I've removed hundreds of useless CSS entries in one go.
|
03-09-2018, 09:45 PM | #11 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
@HHJT,
Would I be right in thinking that these books with the alignment problems are kepubs rather than standard epubs? If so, you might like to consider using the Kobo Patcher, specifically the patch named `Un-Force user text-align in div,p tags in KePubs`. When applying the various slider/button changes for font-size, alignment, line spacing etc in the Aa menu, Kobos make use of an internal CSS override sheet in the firmware. Different overrides are used for kepub and standard epub. The kepub one is quite heavy-handed with some of it's overrides, particularly for text-align. It uses Code:
div, p { text-align: %1 !important; } Code:
body { text-align: %1 !important; } The patch I mentioned earlier changes the kepub override CSS for text-align to match the epub one. |
03-11-2018, 11:31 AM | #12 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
I specify text-align:justify in most of my paragraph styles, though Hitch warns me that this is forbidden by Amazon. Only thus can I be sure of having justified text on the Amazon Look Inside sample. I've never had a problem with this, so I am mystified why one's paragraph styles couldn't similarly call for text-align:left.
(I don't use a body style because that would violate the letter of Amazon's rules.) |
03-11-2018, 12:46 PM | #13 | |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Why would using a body style violate Amazon's rules? |
|
03-11-2018, 01:57 PM | #14 | ||
Addict
Posts: 281
Karma: 7724454
Join Date: Sep 2017
Location: Bethesda, MD, USA
Device: Kobo Aura H20, Kobo Clara HD
|
Quote:
The idea is exactly what you say in your first paragraph: if you leave text-align unset on the body style, e-readers can decide whether to justify or left-align the default text. Specifying one way or the other takes that control out of the user’s hands or forces them to use override hacks (which might be overly aggressive). Of course, specifying it on “most paragraph styles” also breaks e-reader settings; it’s best to only specify in limited sections that may differ from the surrounding text. Obviously centering headers and the like is fine. And if you have an epistolary book like Dracula you might specify left-justified for the letters and full-justified for the newspaper excerpts for effect, so long as you leave the main body text unspecified. Specifying a set line-spacing, font family, or font size is also forbidden for similar reasons: Quote:
Last edited by sjfan; 03-11-2018 at 02:02 PM. |
||
03-11-2018, 08:38 PM | #15 | |
Bookmaker & Cat Slave
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Blithely ignoring the strictures, and saying "well, I haven't been punished so far" doesn't mean it shan't happen in the future. {shrug}. All it will take is ONE reader with the bit between their teeth, and the KQNs shall show up. We've had it happen with a client that was adamant about ragged-right. They were so pissed-off about it that they removed the offending book from sale. Hitch |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Text alignment in Sigil | wdaly | Sigil | 34 | 01-24-2013 02:45 PM |
text alignment issue | shaina | Sigil | 41 | 12-02-2011 10:07 PM |
Hello/Image and text alignment | Derek R | Introduce Yourself | 3 | 06-26-2011 10:47 AM |
PRS-650 Text and alignment issues | henders254 | Sony Reader | 0 | 05-14-2011 08:11 PM |
Text alignment | James_Wilde | iRiver Story | 0 | 10-25-2010 04:22 AM |