07-04-2009, 08:18 AM | #1 |
eBook FANatic
Posts: 18,301
Karma: 16071131
Join Date: Apr 2008
Location: Alabama, USA
Device: HP ipac RX5915 Wife's Kindle
|
Using the width attribute
I have been following the thread on The Complete Guide to Formatting Books for the Amazon Kindle by Joshua Tallent. He said that he had come up with a method of formatting poetry.
HarryT commented that he used the width attribute for that purpose. This caught my attention. I suspect that both use the same method. I have tried using the width attribute and it has never worked for me. Example: <p width="-15">... <div width="-15">... I am obviously doing something wrong but haven't isolated my problem. Can someone point me in the right direction? Thanks, Charlie |
07-04-2009, 09:00 AM | #2 |
Sir Penguin of Edinburgh
Posts: 12,375
Karma: 23555235
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
|
I just checked, and I'm using it the same way:
<p width="-20"> If you're checking your work in a browser, it won't show. The width attribute is nonstandard. |
Advert | |
|
07-04-2009, 09:14 AM | #3 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Yes, it only shows up in the finished Mobi book. I generally use 1em for each "level" of indentation. That looks right to me, although others may of course feel otherwise.
I'm not using negative (hanging) indents, but positive ones. Eg, picking a little verse at random: Code:
Mary had a little lamb its fleece was white as snow. And everywhere that Mary went the lamb was sure to go. Code:
<div>Mary had a little lamb,</div> <div width="1em">its fleece was white as snow.</div> <div>And everywhere that Mary went,</div> <div width="1em">the lamb was sure to go.,</div> |
07-04-2009, 09:17 AM | #4 |
eBook FANatic
Posts: 18,301
Karma: 16071131
Join Date: Apr 2008
Location: Alabama, USA
Device: HP ipac RX5915 Wife's Kindle
|
Nate,
Thank you very much. The browser is the way I test everything. Know of a good non-standard browser? Charlie |
07-04-2009, 06:30 PM | #5 |
Sir Penguin of Edinburgh
Posts: 12,375
Karma: 23555235
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
|
I finally had time today to experiment, and I found a better way to do the hanging indent. Here is an example that works with MobiCreator and uses standards compliant attributes:
<style type="text/css"> p.hanging { margin-left:00; text-indent:-20; } </style> This code fragment is supposed to go in the file header (between the head tags). I stronly urge you to use it instead of the width attribute. P.S. It works in a browser, too. |
Advert | |
|
07-05-2009, 12:21 PM | #6 |
eBook FANatic
Posts: 18,301
Karma: 16071131
Join Date: Apr 2008
Location: Alabama, USA
Device: HP ipac RX5915 Wife's Kindle
|
Nate,
This way looks great. This will force me to learn style sheets as I've really had no need for them before. I assume that the code can be named and used as a Class attribute for <p> and <div>. By adjusting margin-left and text-indent, lines of poetry could be indented to various levels and any word wrap will be correct. You, sir, are an HTML expert. Charlie P.S. It beats the heck out of the poetry method in the book!!! Last edited by crutledge; 07-05-2009 at 12:24 PM. |
07-05-2009, 12:43 PM | #7 |
Sir Penguin of Edinburgh
Posts: 12,375
Karma: 23555235
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
|
If you look over in the Advanced Ebook Formatting Tips thread, it turns out I was wrong about margin-left. It's ignored by MobiCreator. I'd still leave it in just in case you use the same source files to make another format which can use it.
|
07-06-2009, 04:44 AM | #8 | |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Quote:
Unless we check things like this we won't know whether the problems lie with Mobipocket as a format, or with Mobipocket Creator. Regards, Alex |
|
07-06-2009, 05:10 AM | #9 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
All you can do in a Mobi book is to set "global" margins for the entire book:
http://www.mobipocket.com/dev/articl...le=margins.htm You cannot vary the margins for specific parts of the book. Last edited by HarryT; 07-06-2009 at 05:13 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Page Width | kobo2010 | Kobo Reader | 4 | 05-10-2010 08:14 PM |
How to apply fixed-width fonts | EnergyLens | Calibre | 5 | 04-17-2010 12:41 PM |
Error parsing attribute name? | seagull | Calibre | 1 | 01-01-2010 11:30 AM |
Attribute error? | jusmee | Calibre | 2 | 12-15-2009 08:22 PM |
Qs about the objid attribute | DanielCoffey | LRF | 1 | 06-29-2009 07:12 AM |