10-01-2010, 11:27 AM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: kindle
|
CSS margin attribute misbehaves
I'm a website developer, who's now trying to convert a PDF book to Kindle .mobi
The CSS margin attribute with em values has some nasty rendering effects. margin-left/right: break Lists and spans! margin-top and margin-bottom -- I don't see a linear relationship between the css em value and the rendering screen spacing! What's a CSS coder to do? Is there a CSS validation chart for mobi-reader? Thanks, Peter |
10-01-2010, 12:53 PM | #2 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Note that, strictly, mobipocket does not support CSS. At most, the converter can translate the input CSS into something that mobipocket supports...
|
10-01-2010, 03:17 PM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: kindle
|
but mobipocket creator DOES interpret some CSS
For instance
---css --- span {margin:0} /* watch out for strange interpetations */ .italics_fs { font-style: italic } /* This works */ ---html---- <p>This is a test <span class="itatics_fs">to see what</span> happens.</p> is mobi-equivalent to <p>This is a test <i>to see what</i><br /> happens.</p> ----------------- And defining h1 { font-size: 2.25em; margin: 1.12em 0; } Does effect the font-size and margin for <h1>This is a test</h1> Also multiple class names for a element don't seem to be supported I just don't know what the crazy rules are... Your mobi dev doc (http://www.mobipocket.com/dev/articl...TagRef_OEB.htm) is not 100% accurate. For instance, its says <div class="quoted-material">...</div> is not supported -- but IT WORKS on my Kindle 2. I'm a newbie here -- is there a pointer to the html/css quirks experiential lore? |
10-02-2010, 05:05 AM | #4 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
For instance, the mobi format does not support top and bottom margins, it only has the concept of top margin, which is actually expressed as "height". A converter would read whatever margin you specify, converts the top margin to "height" and applies the bottom margin to the "height" of the next element. As far as I know, right margin is not supported at all, and left margin can only be translated as <blockquote>, and it cannot be changed. The "width" mobi property is actually equivalent to CSS "text-indent". Your problem with "ems" could be related to the fact that the mobi format allows only integers to be used with "em" units. |
|
10-03-2010, 06:44 AM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: kindle
|
Thanks, that explanation was very helpful.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error parsing attribute name? | seagull | Calibre | 1 | 01-01-2010 11:30 AM |
Attribute error? | jusmee | Calibre | 2 | 12-15-2009 08:22 PM |
calibre ignore margin-top and margin-bottom | bender | Calibre | 2 | 12-11-2009 06:58 AM |
Using the width attribute | crutledge | Workshop | 8 | 07-06-2009 05:10 AM |
Qs about the objid attribute | DanielCoffey | LRF | 1 | 06-29-2009 07:12 AM |