Today, 01:31 AM | #1 |
Guru
Posts: 672
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
letter-spacing and centring
I often use three asterisks to make a break between paragraphs.
At first, just .stars {text-align:center;margin:1em 0;} <div class="stars">***</div> Then spaced then out with nbsps. Then I thought to use letter-spacing: .break0 {text-align:center; margin:1.5em 0;font-size:1.25em;letter-spacing:2em;} <div class="break0">***</div> But I noticed that it wasn't centred, either in Sigil preview or on Kindle after conversion. The highlighted line in the screencap is noticeably left of page centre. (Text and page have zero margins.) Selecting it includes a space on the right, which is not a separate character in the code. Normally, spaces at the end of a line are ignored for centring anyway. So it seems that letter-spacing in CSS isn't really "space between letters", it's "space after letters". Or maybe they deem the EOL a letter. I'm sure this is all perfectly correct behaviour, but it isn't what I wanted, so to nudge it back to the centre, I added padding: .break {text-align:center; margin:1.5em 0;font-size:1.25em;letter-spacing:2em;padding-left:2em;} That's the top line in the screencap. Offering this work-around in case anyone else is caught out. Last edited by AlanHK; Today at 02:06 AM. |
Today, 02:44 AM | #2 |
frumious Bandersnatch
Posts: 7,523
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
That's probably renderer-dependent. See https://stackoverflow.com/questions/...last-character (and https://www.w3.org/TR/css-text-3/#le...acing-property).
Last edited by Jellby; Today at 02:47 AM. |
Advert | |
|
Today, 03:26 AM | #3 | |
Guru
Posts: 672
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
And this from 2011: https://stackoverflow.com/questions/...element-in-css A lot of weird workarounds there. Negative margins, indents, rtl text. Anyway, it seems a very general effect and unlikely to be "fixed" if it has been tolerated for so long. So take your choice of hacks to fix it. |
|
Today, 03:46 AM | #4 |
Wizard
Posts: 1,229
Karma: 5390614
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Also letter-spacing: is ignored in Libra2 and probably other models.
|
Today, 05:14 AM | #5 |
Resident Curmudgeon
Posts: 75,355
Karma: 133807966
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Letter-spacing | kamanza | ePub | 17 | 02-04-2022 02:11 AM |
Letter-spacing issue | HHJT | ePub | 9 | 08-26-2019 09:40 AM |
letter spacing errors | JeremyBenson | Kindle Formats | 24 | 02-20-2013 07:04 PM |
'letter-spacing' in Mobi | hkdorama | Kindle Formats | 4 | 07-26-2010 06:35 AM |