View Single Post
Old 02-16-2011, 01:33 PM   #6
DMSmillie
Enquiring Mind
DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'
 
DMSmillie's Avatar
 
Posts: 562
Karma: 42350
Join Date: Aug 2010
Location: London, UK
Device: Kindle 3 (WiFi)
Just an additional comment on what I wrote above about CSS margins and the "margin-collapse" default.

In ebook terms, this will only apply to EPUB based ebooks.

Because the MOBI format doesn't actually use CSS internally, but instead, for vertical margins, uses a proprietary "height" attribute which sets a top margin, you do need to think about how the margins will interact between one element and the next. The overall result from the conversion from CSS to "MOBI HTML" could result in margins being added to each other, with over-large gaps between text elements as a result. So if you intend to convert your HTML or EPUB to MOBI format, you need to think a bit more about how you set your margins, so that you don't end up with bigger gaps between some elements than you intended.

For example, Kindlegen will translate the following HTML:
Code:
<p style="margin-top: 12px; margin-bottom: 12px">Paragraph text here.</p>
<p style="margin-top: 12px; margin-bottom: 12px">Paragraph text here.</p>
into:
Code:
<p height="12">Paragraph text here.</p>
<div height="12"></div>
<p height="12">Paragraph text here.</p>
<div height="12"></div>
The result of which will be a double height margin between the two paragraphs. An EPUB using the original HTML code, on the other hand, is most likely to collapse the vertical margins between the two paragraphs, leaving a single height blank space.
DMSmillie is offline   Reply With Quote