Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 04-15-2012, 04:07 PM   #1
travger
Evangelist
travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.
 
travger's Avatar
 
Posts: 469
Karma: 270594
Join Date: Aug 2010
Device: palm tx, Windows XP, Windows7
Mysterious html

Hi,
I apologize if it's wrong place to put my question.
I decided to tweak some mobi books but my knowledge of html is sadly lacking. Could somebody please enlighten me:

<p height="0em" width="0pt"> why not simple </br> ?

or <a></a> - why? An empty anchor?

<a></a><p height="1em" width="5em"> seems to be put randomly before paragraph tags.
I know what happens when I change p-s to <p height="0em" width="2em">, but that's all.

Can I delete all <a></a>-s? Can I replace <p height...> tag to simple <p> (I think Mobi Creator takes care of indents)? (Well, I know that I can, but does it affect future conversion or readability in other readers etc?)

Most important, WHY <p height...> if <p> or </br> is sufficient?

Thank you.
travger is offline   Reply With Quote
Old 04-15-2012, 04:42 PM   #2
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 64,976
Karma: 42992227
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Mini, iPhone 4, MS Surface Pro, N7
The "width=" and "height=" attribute on a paragraph in a Mobi book are used to control the indent of the first line, and the space between paragraphs, respectively.
HarryT is offline   Reply With Quote
Old 04-15-2012, 05:15 PM   #3
travger
Evangelist
travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.
 
travger's Avatar
 
Posts: 469
Karma: 270594
Join Date: Aug 2010
Device: palm tx, Windows XP, Windows7
Quote:
Originally Posted by HarryT View Post
The "width=" and "height=" attribute on a paragraph in a Mobi book are used to control the indent of the first line, and the space between paragraphs, respectively.
Yes, that's almost only thing here I understand. So if I don't want any space between the paragraphs, I can delete whole height 1em part? And then search and replace bigger ems with br/?
travger is offline   Reply With Quote
Old 04-15-2012, 05:36 PM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 9,423
Karma: 43260000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
So if I don't want any space between the paragraphs, I can delete whole height 1em part? And then search and replace bigger ems with br/?
I believe the <p height="0"> is how you achieve no space between paragraphs. If you just used <p>blah</p><p>blah</p>, I think that will result in block (no indent) paragraphs with a space between the two paragraphs. I don't think there's any difference between <p> and <p height="1em" width="0">.

And <br /> will only ever get you to the next line. You can't "stack" them to make a larger space.
DiapDealer is offline   Reply With Quote
Old 04-15-2012, 05:43 PM   #5
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 7,015
Karma: 17761729
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International & Sony PRS-T1 & BlackBerry PlayBook
Actually, when run through KindleGen, at least, a bare <p> with no height or width set will give indented paragraphs with no space between them, at least in results viewed on a K2. It might be different for KF8 format output.

If you want no-indent and linespacing, then you have to set height/width wherever you want it in the <p>s or via CSS before conversion.
ATDrake is online now   Reply With Quote
Old 04-15-2012, 05:48 PM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 9,423
Karma: 43260000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I stand corrected. I knew I should have done some testing.
DiapDealer is offline   Reply With Quote
Old 04-15-2012, 06:23 PM   #7
travger
Evangelist
travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.
 
travger's Avatar
 
Posts: 469
Karma: 270594
Join Date: Aug 2010
Device: palm tx, Windows XP, Windows7
That's my point: maybe there's some good reason why book has to be cluttered with so much code, if so, I'd like to know. Or is it all just junk from word conversion?

Why not use <br> instead of <p height="0em" width="0pt"> ? Both result in one empty row, yes? But if I want to convert to ePub, could it be that it likes attributed variant more than <br/>?

And I have a feeling that I can stack <br>-s to make larger space. I won't see bigger space if I open html in the browser, only after putting it through MobiCreator.
travger is offline   Reply With Quote
Old 04-15-2012, 06:33 PM   #8
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 7,015
Karma: 17761729
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International & Sony PRS-T1 & BlackBerry PlayBook
Much, but not all, of what shows up in an unpacked Mobi file is often redundant or inapplicable carryover cruft (like font-face changes which involve named fonts which are not carried in any of the Kindle devices or apps).

You can safely strip out all the non-functional stuff and replace most of the hard-coded functional bits with some CSS classes and a stylesheet whether you recompile as Mobi or go on to convert to ePub.

The best way to figure out (besides trial and error experimentation) is by referring to the official Mobipocket format documentation, such as it is, for which bits are actually functional and non-redundant to the display defaults.

ETA: Amazon's Kindle Publishing Guidelines PDF may also be of use. IIRC they used to have some kind of appendix of CSS tags in the back which could get "translated" to the Mobi format version of HTML.

Last edited by ATDrake; 04-15-2012 at 06:38 PM.
ATDrake is online now   Reply With Quote
Old 04-15-2012, 06:40 PM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 9,423
Karma: 43260000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
And I have a feeling that I can stack <br>-s to make larger space. I won't see bigger space if I open html in the browser, only after putting it through MobiCreator.
Easy enough to test... why speculate?
DiapDealer is offline   Reply With Quote
Old 04-15-2012, 06:57 PM   #10
travger
Evangelist
travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.
 
travger's Avatar
 
Posts: 469
Karma: 270594
Join Date: Aug 2010
Device: palm tx, Windows XP, Windows7
I have frowned over official documentation, but it's rather poor on 'why' part. 'This is useless crap' and 'this works nicely' I can usually find with experimentation, but WHY...

I am under impression that mobi does not support CSS? That it embeds Css things into html when building mobi?
travger is offline   Reply With Quote
Old 04-15-2012, 07:30 PM   #11
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 7,015
Karma: 17761729
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International & Sony PRS-T1 & BlackBerry PlayBook
That's exactly right. CSS is just used for your preparatory convenience. It all gets reinterpreted into the corresponding HTML when the Mobi is actually made.

The Mobipocket documentation's most useful applicable part is probably the list of supported HTML tags, which at least gives you an idea of what a given tag will do and how it ends up displaying, and what options you have for modifying the display (not many). At least you get a sense of what won't work, keeping in mind that Mobi is really based on some kind of modified version of the old HTML 3.2, IIRC.
ATDrake is online now   Reply With Quote
Old 04-15-2012, 08:30 PM   #12
Prestidigitweeze
Fledgling Demagogue
Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.Prestidigitweeze ought to be getting tired of karma fortunes by now.
 
Prestidigitweeze's Avatar
 
Posts: 2,278
Karma: 25232615
Join Date: Feb 2011
Location: White Plains
Device: Aura HD; Nexus 7; PRS-350, 950; Kindle K; OnePlus One; Galaxy S4; MBP.
Does MR have a reference library section for the creation of e-reader content? If not, it should. We should collaborate on or link to a guide to creating bulletproof e-books in various formats, a glossary of code for someone who's never learned HTML, and still another on cleaning up preexisting e-books.
Prestidigitweeze is offline   Reply With Quote
Old 04-16-2012, 02:03 AM   #13
travger
Evangelist
travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.travger ought to be getting tired of karma fortunes by now.
 
travger's Avatar
 
Posts: 469
Karma: 270594
Join Date: Aug 2010
Device: palm tx, Windows XP, Windows7
Thank you for your help.
Some kind of simplified guide is excellent idea. There are lots of good 'html for beginners' tutorials, but they all tend to stray into webpage building and that's much too complicated for (my) ebook needs.

Example from toc:
<div height="0em"></div><a filepos="0000067426"><span><span>Chapter 3</span></span></a><br/>

1. WHY 2x span?
2.The <div> tag is used to group block-elements to format them with styles - but lots of styles in ebook are not such a good idea? (different readers etc). I imagine vaguely how I may want to color some block pink or green... Does mobi ebook need <div> tag at all?
In that example <div> says only that there's no empty space between lines in toc, so why not:
<p height="0em" width="0em"> ?
or:
<a filepos="0000067426">Chapter 3</a><br/> ?


Another example:
<a></a><p width="-58pt" align="left"><a href="#filepos50598"><font color="blue"><u>Chapter 1</u></font></a></p>

WHY <a> without any attribute?


I've understood one-letter tags like <a> and <b>, but <div> and <span> confuse me to tears.
travger is offline   Reply With Quote
Old 04-16-2012, 02:23 AM   #14
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 64,976
Karma: 42992227
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Mini, iPhone 4, MS Surface Pro, N7
It's probably machine-generated code. I wouldn't lose any sleep over it.
HarryT is offline   Reply With Quote
Old 04-16-2012, 02:24 AM   #15
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 7,015
Karma: 17761729
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International & Sony PRS-T1 & BlackBerry PlayBook
1. The span is total cruft, probably left behind by some messy word processor auto-html. Feel free to get rid of it. Spans are only ever important in an e-book if they have a class as a hook for some sort of CSS formatting or a lang attribute to denote a foreign language phrase you might want to format differently to make it stand out.

2. That particular div looks superfluous, especially with a height of 0 em and nothing inside. If a div has nothing inside, assume it's cruft and delete.

Only if it's got a height set might you possibly want to keep it in case it's some sort of important scene spacer, but you can get a much better effect by wrapping a new div around the entire "spaced" section and giving it a class hook to anchor some CSS formatting to get the linespacing effect (or just put in a manual spacer like an <hr /> line).

You wouldn't need a <p> with height set to 0, because the default for Mobi display on e-ink Kindles (may be different on K4apps and other readers) is for no spacing between lines by default anyway. However, you could wrap the <a> within a <p> and omit the <br /> as you'd get a line-break with the <p> anyway and that would allow you to style the formatting later in case you decide you do want some space between lines or you want no-indent in the TOC entries (the functional part of the hypothetical <p width="0">).

3. That <a> is actually functional and pretty important, as it acts as a link to wherever Chapter 3 is located. You need to keep that one. But you can get rid of the font tags. You can't even see colours in most Mobi-supporting devices anyway (maybe K4PC/iDevice apps).

All you really need to look at in an HTML tutorial is what the "presentational attributes" possible for a given HTML tag are, because that's all you'll be able to use with Mobi, and you'll only be able to use a small subset of them (eg. anything involving setting a colour, you can ignore).

Hope this helps.
ATDrake is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Recipe HTML content differs from raw html of index.html. krunk Calibre 4 09-20-2010 10:48 PM
Access to local HTML files and content, HTML ebooks, annotation on HTML ebooks leo315 enTourage Archive 2 05-10-2010 03:40 PM
Mysterious Island mtravellerh Deals, Freebies, and Resources (No Self-Promotion) 0 12-27-2008 06:28 AM
Mysterious Companion software sarikan iRex 6 11-27-2008 05:37 AM
The Mysterious Island kevinofengland Sony Reader 6 09-27-2008 09:52 AM


All times are GMT -4. The time now is 08:36 PM.


MobileRead.com is a privately owned, operated and funded community.