![]() |
#1 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Dec 2012
Device: none
|
Variable Leading, or Is Validation Necessary?
In a print book, one might have a space break between sections, which would typically be a carriage return.
Like this. In an ebook, you could specify this with a margin-top or margin-bottom of 1em. On the other hand, you might want (and I do want) less space between body text and a block element, such as a block quotation, to show that it's part of the continuing narrative rather than a break in time, setting, or subject. Therefore, I specified a "spacer" tag with a margin-bottom of .7em. It works fine in Kindle, though not in epub readers, but only if I use something like this: <p class="spacer"> The problem is, if I run it through the W3 validator, it fails, because there's no closing </p> tag. But if I add the closing tag, Kindle no longer recognizes the .7em--it treats it as a full 1em carriage return. I've tried using margin-top instead of margin-bottom, using percentages (both 70%, which actually looked like 700%, and .7%, which was just a carriage return), and adding the !important declaration, none of which worked. The Amazon Kindle Publishing Guide says that Kindle ignores line-height under 120%, so reducing line-height won't help. So I ask you: is there a way to do this? And if not, do I really need validated HTML? I don't see any requirement for the latter in Amazon's Kindle Guidelines or B&N's Pubit Formatting Guide. Last edited by NeoRealist; 12-20-2012 at 08:19 PM. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
You can try making it autoclosing with <p class="spacer" />, but be aware that a lot of ePUB readers will ignore empty paragraphs.
|
![]() |
![]() |
![]() |
#3 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
If your only goal is creating a book for Kindle, you can ignore validation as long as you get the desired results.
But if you want an ePub book, then yes, you should care about validation, and you must include the closing tag, or make the tag self-closing: <p class="spacer" /> but some readers might ignore empty paragraphs, so you can add some blank stuff: <p class="spacer"> </p> Instead of line-space, you could try reducing font-size. |
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Dec 2012
Device: none
|
Thanks. You're right--the epub readers I used (ADE and BN) did ignore the empty paragraphs (including with ), as did the Kindle.
After further experimentation, I found that deleting the blank paragraphs and adding the margin-top or -bottom to the tags for the surrounding paragraphs with text fixed it in both mobi and epub. |
![]() |
![]() |
![]() |
#5 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
![]() |
![]() |
![]() |
#6 |
350 Hoarder
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,574
Karma: 8281267
Join Date: Dec 2010
Location: Midwest USA
Device: Sony PRS-350, Kobo Glo & Glo HD, PW2
|
Same here, it's the method I use that seems most reliable, as well as safe from losing the spaces when you do a conversion in Calibre... even if you tell Calibre to delete blank lines for the conversion, they'll still remain.
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
It is not correct. A <p> </p> will be honored because it is not an empty paragraph. A <p /> will be ignored and sometimes also a <br />.
I have seen this behaviour on all Sony and Kobo readers. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using Class Variable in Def | Agama | Development | 1 | 08-21-2012 07:05 AM |
Variable payments come to eBooks | WhichP | News | 4 | 08-04-2012 03:52 PM |
PATH variable in Windows | kapsi | Calibre | 3 | 05-16-2011 05:12 PM |
Annoying Variable Font Size | Brandon202000 | Sony Reader | 2 | 12-18-2007 03:36 AM |