02-10-2018, 08:01 AM | #1 |
Enthusiast
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
|
How to set line height for book content?
Hello!
I've been messing with this for a while now, with little success. All I managed to do is to set it to an undetermined size by adding "line-height" to the styling to be removed. Setting the Line size in the look and feel > layout section does nothing, what's even the point of it? Setting something like this as extra CSS only changed a few lines. (I was lucky to even notice it) Code:
p, div, span { line-height: 10; } Extra question: How do I change the text from right/left aligned and justified? Last edited by mzso; 02-10-2018 at 09:51 AM. |
02-10-2018, 09:02 AM | #2 |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
I use Transform in Look and Feel for line-height (4 entries), plus I have some entries in Styling to add this code when it's not included in the <body class> code:
If line-height is less than or equal to 1.2, change it to 1.2. If line-height is less than or equal to 1.2em, change it to 1.2. If line-height is greater than or equal to 1.2, change it to 1.2. If line-height is greater than or equal to 1.2em, change it to 1.2. For text alignment, manually change (in the .css file) to one of the following for the CSS class: text-align: left; text-align: right; text-align: justify; text-align: center; However, I have a bunch of entries in Styling that do this for me most of the time when converting, and I rarely have to manually change it. Here's what I have in Styling: Spoiler:
I also have 30pt for left and right margins in Page Setup (at the bottom right of that screen). Last edited by theducks; 02-10-2018 at 12:15 PM. Reason: Add Spoiler for long code paste |
Advert | |
|
02-10-2018, 09:15 AM | #3 |
Resident Curmudgeon
Posts: 73,661
Karma: 127838198
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
With most current programs/Readers, you are best to have a left/right margin of 0 and use the setting to change the margins.
Also, that is one very sloppy stylesheet. Last edited by JSWolf; 02-10-2018 at 10:04 AM. |
02-10-2018, 09:23 AM | #4 | |
Enthusiast
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
|
Quote:
Wow that's a long list. That transform are only applied to content, or for chapter titles and such also? What ".calibre" stand for? Probably a stupid question. But what does using 1.2 (no unit?) and 1.2em mean? Last edited by mzso; 02-10-2018 at 09:27 AM. |
|
02-10-2018, 09:25 AM | #5 |
Enthusiast
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
|
|
Advert | |
|
02-10-2018, 12:25 PM | #6 | |
Well trained by Cats
Posts: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
cm, in, pt, px are ABSOLUTE values and should be avoided as the do not scale. 1.2 or 120% of the current font height. 1.2 is standard. IMHO, you only need this for the Body (font size), as the paragraphs inherit this. The only time I found I need to use another line-height: 1.2; , is when I use a dropcap or big letter in the same paragraph block (keeps the line space the same as its neighbors) |
|
02-10-2018, 12:53 PM | #7 | |
Enthusiast
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
|
Quote:
|
|
02-10-2018, 06:03 PM | #8 | |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
Quote:
If the line-height is not included in the <body> selector (such as, in the .calibre CSS selector) or is not included in the paragraph class selectors, the line-height will not be standard (i.e., the lines will be too close together). Everything I included in my response helps to keep the line-heights standard in all the epub files I convert and fixes several other things, such as, justifying the paragraphs, having standard indents of 1.2em, having no indents for chapter opening paragraphs, etc. |
|
02-10-2018, 07:26 PM | #9 |
Resident Curmudgeon
Posts: 73,661
Karma: 127838198
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Don't take the risk that some ePub reader won't get 1.2. Use 1.2em just to be on the safe. Plus, the code looks better that way.
|
02-10-2018, 07:56 PM | #10 |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
|
02-10-2018, 08:36 PM | #11 |
Well trained by Cats
Posts: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
02-10-2018, 09:19 PM | #12 | ||
Wizard
Posts: 2,080
Karma: 8796704
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
Quote:
Quote:
The first screenshot is 1.2 the second is 1.2em. bernie |
||
02-10-2018, 10:07 PM | #13 |
Wizard
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
The difference between line-height: 1.2; and line-height: 1.2em; is that when inherited, the unitless version will apply to the font size of the inheriting element, while 1.2em will be based on the font size of the original element.
e.g. Code:
stylesheet: div.em-units { font-size: 1em; line-height: 1.2em; } div.unitless { font-size: 1em; line-height: 1.2; } p { font-size: 0.5em; } html: <div class="em-units"> <p>This text has line height 2.4 times its font size.</p> </div> <div class="unitless"> <p>This text has line height 1.2 times its font size.</p> </div> |
02-10-2018, 10:13 PM | #14 |
Addict
Posts: 281
Karma: 7724454
Join Date: Sep 2017
Location: Bethesda, MD, USA
Device: Kobo Aura H20, Kobo Clara HD
|
1.2em is generally wrong, though in simple cases it can be the same as a plain 1.2. But the latter is inherited as a factor relative to whatever font is in use when it’s rendered, and will scale properly. The “em” version is inherited as an absolute size (calculated from the font it was originally applied to), so will be way off if your main body text style applies a font-size in a separate (more deeply nested) rule than the line-height was.
Especially in a body rule (and usually everywhere), use plain 1.2 unless you really know what you’re doing. The Mozilla link deback posted has a good illustration of this at the bottom. EDIT: What GeoffR just said. Last edited by sjfan; 02-10-2018 at 10:16 PM. |
02-10-2018, 10:13 PM | #15 | |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
Quote:
|
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aura H2O Line height setting is ignored | kAlvaro | Kobo Reader | 6 | 08-09-2016 07:59 AM |
Calibre - changing the line-height in the user interface book description | CynthiaBlue | Development | 2 | 02-05-2016 12:48 AM |
Set maximum height for images in reader | truth1ness | Library Management | 0 | 10-06-2015 12:36 PM |
optimal line height ? | cybmole | Sigil | 6 | 09-05-2013 09:30 AM |
Line height insanity! | Kamikuza | Conversion | 6 | 10-24-2012 11:56 PM |