09-23-2024, 01:52 PM | #1 |
Evangelist
Posts: 408
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
line-height confusion
I have a page the has one line of text. I'd like there to be only a small amount of space between the lines if it is too long to render on just one line (it wraps). I had thought setting a small line-height would help, but whatever I use for line-height I get the same distance between the lines. I've tried large and small numbers with em, unitless and %, but it always looks the same.
What obvious mistake am I making? Code:
p.part { font-size: 1.4em; margin-top: 2em; line-height: 0.8em; text-align: center; text-indent: 0; } Code:
<?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <head> <title>Schwarzschild’s Singularity</title> <link href="css/nyrb.css" rel="stylesheet" type="text/css"/> <meta content="urn:uuid:f6153998-8e9b-4e44-bcd6-bee1e61d1b96" name="Adept.expected.resource"/> </head> <body> <div> <p class="part"><a id="uIjbHnpIXhoMvLyexvkU5BC"></a>Schwarzschild’s Singularity</p> </div> </body> </html> |
09-23-2024, 01:57 PM | #2 | |
Resident Curmudgeon
Posts: 76,049
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
Advert | |
|
09-23-2024, 02:01 PM | #3 | |
Evangelist
Posts: 408
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
EDIT: Perhaps the line spacing set on the device is overriding the line-height setting? But that don't make sense to me, since CSS font-size affects device font size. Last edited by foosion; 09-23-2024 at 02:06 PM. |
|
09-23-2024, 02:09 PM | #4 | |
Resident Curmudgeon
Posts: 76,049
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
The line-height slider has no effect on the font size. |
|
09-23-2024, 02:18 PM | #5 | |
Evangelist
Posts: 408
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
|
|
Advert | |
|
09-23-2024, 02:19 PM | #6 |
Resident Curmudgeon
Posts: 76,049
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
09-23-2024, 02:21 PM | #7 |
A Hairy Wizard
Posts: 3,212
Karma: 19000001
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
you can see if you can override the kobo slider by including !important in the css??
p.part {line-height:.8 !important} (no units required) |
09-23-2024, 02:21 PM | #8 |
Evangelist
Posts: 408
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
I changed p.part to h3.part. Now it behaves as expected - line-height affects spacing between the wrapped lines.
|
09-23-2024, 02:22 PM | #9 |
Resident Curmudgeon
Posts: 76,049
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
09-23-2024, 02:24 PM | #10 |
Evangelist
Posts: 408
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
I find this behavior very odd.
Epub in calibre and kepub on a Kobo Clara BW. EDIT: Is there any good reason line-height in CSS would matter for an h3 tag but not a p tag? Last edited by foosion; 09-23-2024 at 02:29 PM. |
09-23-2024, 02:34 PM | #11 | |
Evangelist
Posts: 408
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
I have been using it in headings precisely to deal with the issue of excess space between wrapped headings when the font-size of the headings is greater than 1em. Which is why I thought to change p to h3 - it had worked with headings. But it doesn't make sense to me that the Kobo renderer on a kepub would honor line-height for one tag but not another. |
|
09-23-2024, 02:42 PM | #12 |
Resident Curmudgeon
Posts: 76,049
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
09-23-2024, 02:44 PM | #13 |
Evangelist
Posts: 408
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
|
09-24-2024, 12:04 AM | #14 | |
Well trained by Cats
Posts: 30,407
Karma: 58055234
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Code:
line-height: 1.2 /* (a normal default) */ line-height: 120% |
|
09-24-2024, 12:22 AM | #15 | |
Bibliophagist
Posts: 39,828
Karma: 154147706
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
I have unfond memories of one ePub where the misbegotten formatter used pc (pica) line heights along with Q, px and pt. It likely looked great on whatever device they used to read it but it was a total pain to generalize so it looked good on multiple devices. For those who are wondering what the heck a Q is, it was/is a standard used in the Japanese typesetting industry being 0.25mm (Q (級) for quarter). |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Line height issue | Mercador | Kobo Reader | 19 | 07-21-2020 02:32 PM |
CSS line height vs Kobo line spacing slider? | bongoman | Kobo Reader | 2 | 07-12-2020 01:25 PM |
line height | Rellwood | Conversion | 3 | 04-07-2018 04:34 AM |
Aura H2O Line height setting is ignored | kAlvaro | Kobo Reader | 6 | 08-09-2016 07:59 AM |
Line spacing confusion | Wrongway | Kobo Reader | 3 | 04-05-2014 07:23 AM |