![]() |
#1 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
Line-height from ePub to AW3
Working in ePub, I have text that is split by <br/> tag, where the tage has a css style that adjusts the height of the break.
Code:
Line 1<br class="brheight"/>Line 2 css: .brheight { line-height: 2.5em; } Any ideas as to what's happening in the conversion process that causes this error? |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Try leaving off the 'em'
line-height is 'unit less' . it inherits the unit from the current block line-height: 1.2%;
line-height: 2.5; |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
Quote:
Still, thanks for the tip on em; will be sure to (dis)integrate that into my future css. |
|
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
<br/> is a bad idea when you can do this in CSS. The following will work and you can dump the <br/> as the CSS is creating the space and not the <br/>/
Code:
<p class="brheight">This is a test></p> .brheight { margin-top: 2.5em; } |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The display in what? Kindles, calibre's viewer?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
In calibre's viewer and in Kindle.
re: using <p> tags — sometimes I'd like a line break that still inherits the specific class attributes of the initial element. Using a <br/> tag is an efficient way to do that (provided it works). Again, what's surprising to me is that it displays without any problem in ePub (both in Sigil and in calibre), but then gets ignored in an AZW3 conversion. |
![]() |
![]() |
![]() |
#7 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,183
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
Quote:
Code:
<p>*</p> |
|
![]() |
![]() |
![]() |
#8 | |
Not Quite Dead
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 195
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
Quote:
As you can tell from comparing the code transformation of any epub to azw3 conversion, Calibre can produce some bizarro tag soup that is difficult to describe. Apparently this is by design. The only way to insure what you want after a conversion is to re-edit the azw3 version. For me, this means eliminating any style with "calibre" in its name. This is usually more trouble than it is worth because Calibre, overall, does a commendable job in dealing with all the contingencies that various coding habits present. |
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,069
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
I did some playing around with this, adding the style "line-height: 2.5em" to a <br> element. I used the Kindle Previewer to convert the book in order to avoid any issues that may be introduced by calibre conversion.
In the MOBI portion of the Master MOBI created by the Previewer, the style is simply eliminated from the <br>. In the KF8 (azw3) the style is left intact, but is ignored by the renderer when displaying the book. In the KFX (enhanced typesetting) view created by the Previewer the line-height was retained, but applied to the line above the break, causing there to be two gaps in the paragraph. This reflects how most modern Kindle devices and apps would display that markup in a book sold on Amazon. I recommend just using multiple <br> elements and living with the restriction of having only integer multiple sizes available. Last edited by jhowell; 01-20-2019 at 09:52 PM. |
![]() |
![]() |
![]() |
#10 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
However, if this is a section break, you can try a padding-top instead of a margin-top. I know this works better with ePub. I don't know what it would do in Mobi. But KF8 should works and KFX, I am unsure. |
|
![]() |
![]() |
![]() |
#11 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
So, if I absolutely have to rely on <p> for consistently displaying the desired line-break characteristics, obviously that's the way to go! But I am curious as to why <br /> code should be problematic. Has it been deprecated? I confess that I'm "self-educated" on html, which means there are huge gaps in my knowledge and probably several aspects that I THINK I understand, but actually don't (like, assigning the "em" unit to line-height, for example!).
Last edited by ElMiko; 01-20-2019 at 02:38 PM. |
![]() |
![]() |
![]() |
#12 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
As for <br/>, I prefer to deal with line spacing in CSS and not use them in that manor. Yes, <br/> works for breaking a line in two. But for using it to add a line space, forget it. It's a kludge and poor coding. Also, it's more difficult if you want ot change the spacing. You have to then dump the <br/> and put in the SS code that should have been there in the first place. As for em, there's no reason not to use it as it's scalable unlike px or pt. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
line height | Rellwood | Conversion | 3 | 04-07-2018 04:34 AM |
Line Height problem when converting from epub to pdf | valida | Conversion | 7 | 10-06-2017 05:44 AM |
Line Height (Tibetan font) EPUB to PDF | ncs | Conversion | 0 | 02-05-2014 02:21 AM |
[Old Thread] Epub Output: Line Height | greenapple | Conversion | 20 | 01-27-2013 09:27 AM |
Epub line height problem | dorotie | Calibre | 5 | 08-24-2010 03:23 PM |