View Single Post
Old 07-17-2009, 04:39 PM   #25
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
Ok, here's what I've learnt works better for .html that will be converted to multiple ebook formats (while writing GuteBook.pl):
  • change any <pre> to <pre><small><tt> and </pre> to </tt></small></pre>. The <small> helps with the display on small screen ebook readers and the <tt> is recognised in Mobipocket as a monospaced font!!!
  • use a body CSS style declaration, placed in the <style> section, like:
    body { margin-left: 2%; margin-right: 2%; text-align: justify; text-indent: 2em;}
    or just include this directly in the HTML <body> tag like:
    <body style="margin-left: 2px; margin-right: 2px; text-align: left; text-indent: 0em; font-size: +1">
    Of course, when the ebook hardware reader can control things like text-justification, font-size, etc. it may be better to omit those instead.
  • <p> paragraph spacing can be controlled with a CSS style declaration, placed in the <style> section, like:
    p {text-indent: 2em; margin-top: 0em; margin-bottom: 0em; padding-top: 0em; padding-bottom: 0em}
  • same thing with <br> that cause too big of a break, i.e., placed in the <style> section:
    br {margin-top: 0em; margin-bottom: 0em; padding-top: 0em; padding-bottom: 0em}
  • <h1> .. <h6> may not center properly if there are left/right margins set in the <body> tag, so for them it is best to use the CSS style, placed in the <style> section:
    h1, h2, h3, h4, h5, h6 { margin-left: 0; margin-right: 0; text-align: center; }
  • Mobipocket: for anchor links to Chapter headings to start on a new page with pagebreak HTML <h1>...<h6> tags, use:
    <a style="page-break-before: always;" name="CHAPTER_I" id="CHAPTER_I"></a>
    <h2>CHAPTER I</h2>
    but not:
    <h2 style="page-break-before: always;"><a name="CHAPTER_I" id="CHAPTER_I"></a>CHAPTER I</h2>
  • split combined <a id/name and href> tags into <a name> and <a href> like:
    <a id="linkback" name="linkback" href="#linkto">...</a> into
    <a id="linkback" name="linkback"><a href"#linkto">...</a>
  • strip (depreciated) width, border, height from within <img> to avoid squished pictures or even disappearing ones for .imp and also remove any width elements within the <div class=figcenter> which breaks for .epub, leaving only:
    <img src="filename.jpg" /> and <div class="figcenter">
    (p.s. this changes the preferred coding of Project Gutenberg .html ebooks with illustrations.)
Try adopting some of these "rules" for your next mulitple ebook creations and see if they help!

Last edited by nrapallo; 07-17-2009 at 06:19 PM. Reason: fixed formatting
nrapallo is offline   Reply With Quote