Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-25-2011, 10:20 PM   #1
eggheadbooks1
Read, don't parrot.
eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.
 
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
How can I amend the style definition in HTML to fix Kindle default?

This is not my problem because I convert to mobi before upload to Kindle, but I'm trying to help out those who just want to upload HTML to Kindle for conversion:

Kindle's converter automatically indents the first line of every paragraph. So if you want your paragraphs to flush left, Kindle advises:

"The first line of each paragraph indents by default. You can change the indentation of the first line of a paragraph using the width attribute:
<p width="N"> (pixels), <p width="N%">,<p width="Nem"> or <p width="Npt">"

Now, who wants to do that all through a 300-page book? I would think there might be a way to amend the Normal paragraph style definition instead. For example, in a document with a flushed left paragraph, justified, and with a 12 pt space after it, the definition looks like this:

p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0in;
margin-right:0in;
margin-bottom:12.0pt;
margin-left:0in;
text-align:justify;
font-size:10.0pt;
font-family:Georgia;}

Does anyone know how or where the above definition might be amended as per Kindle's suggestion? I've tried various ways without success.

If not, the code for my paragraphs reads:

<p class=MsoNormal>blah blah blah blah.</p>

Where would I add the <p width="N"> code (or one of the other variants listed by Kindle). I've tried before and after the <p class=MsoNormal> but with no success either.

Thanks.

P.S. I am aware of formatting workarounds in Word, but this question is about code.
eggheadbooks1 is offline   Reply With Quote
Old 06-26-2011, 12:32 AM   #2
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: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The "text-indent" CSS attribute is how you control the indentation in the first line of each paragraph. I have absolutely no idea how Kindle's converter will handle that css, though. I've never used it. I assume you're talking about sending HTML files to your Kindle's email address and having them convert the files for you?

To eliminate the indentation and make it flush with the other lines, just add the "text-indent:0;" to your existing css:
Code:
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin-top:0in;
margin-right:0in;
margin-bottom:12.0pt;
margin-left:0in;
text-align:justify;
text-indent: 0;
font-size:10.0pt;
font-family:Georgia;
}
DiapDealer is offline   Reply With Quote
Advert
Old 06-26-2011, 02:16 AM   #3
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: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Doing the replacement through a whole book involves no more than doing a search and replace of "<p>" with "<p width="1em">" (or whatever your preference is).
HarryT is offline   Reply With Quote
Old 06-26-2011, 09:49 AM   #4
dwig
Wizard
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 1,613
Karma: 6718479
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Surface Go & Kindle 3 - Retired: DellV8p, Clie UX50, ...
Quote:
Originally Posted by eggheadbooks1 View Post
... the definition looks like this:

p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0in;
margin-right:0in;
margin-bottom:12.0pt;
margin-left:0in;
text-align:justify;
font-size:10.0pt;
font-family:Georgia;}

...
... also, you should follow the Kindle Publishing Guidelines and not specify a font or font size for the main text.

In addition, the indent along with top and bottom margins should be specified in em units rather than a fixed size unit so that they remain proportional to the text size when the reader chooses a different base text size. This would be more appropriate:

p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0;
margin-right:0;
margin-bottom:1em;
margin-left:0;
text-align:justify;
text-indent: 0;
}
dwig is offline   Reply With Quote
Old 06-26-2011, 09:52 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,931
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by dwig View Post
... also, you should follow the Kindle Publishing Guidelines and not specify a font or font size for the main text.

In addition, the indent along with top and bottom margins should be specified in em units rather than a fixed size unit so that the indent remains proportional to the text size when the reader chooses a different base text size. This would be more appropriate:

p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0;
margin-right:0;
margin-bottom:1em;
margin-left:0;
text-align:justify;
text-indent: 0;
}
Code:
p.MsoNormal, li.MsoNormal, div.MsoNormal {
    margin-top: 0;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
    text-align: justify;
    text-indent: 1.2em
}
That would be better for a paragraph that one wants indented. Also, removing the excess space between the paragraphs makes it look nicer.
JSWolf is offline   Reply With Quote
Advert
Old 06-26-2011, 02:12 PM   #6
eggheadbooks1
Read, don't parrot.
eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.eggheadbooks1 figured out that Keyser Söze was the Kevin Spacey character in less than 20 minutes.
 
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
Quote:
Originally Posted by DiapDealer View Post
The "text-indent" CSS attribute is how you control the indentation in the first line of each paragraph. I have absolutely no idea how Kindle's converter will handle that css, though. I've never used it. I assume you're talking about sending HTML files to your Kindle's email address and having them convert the files for you?

To eliminate the indentation and make it flush with the other lines, just add the "text-indent:0;" to your existing css:
Code:
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin-top:0in;
margin-right:0in;
margin-bottom:12.0pt;
margin-left:0in;
text-align:justify;
text-indent: 0;
font-size:10.0pt;
font-family:Georgia;
}
Worked perfectly. Thanks!
eggheadbooks1 is offline   Reply With Quote
Old 06-28-2011, 04:14 PM   #7
AThirstyMind
A Thirsty Mind
AThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with others
 
Posts: 92
Karma: 2546
Join Date: May 2011
Location: Lubec, Maine
Device: Kindle Fire, iPad, iPhone
Well, I agree with all of the above, but I get a bit more explicit about it. I also build a new style for a flush left....NormalFlush...and base it on the regular Normal style and in the style description in html for NormalFlush I make sure this text is there:

margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
text-indent:0in;
font-size: whatever you want to use

Probably the "in" part isn't necessary, but I've left it off, and left off the semi-colon or the colon...and it doesn't work...so I use exactly this every time. I don't have a problem with the prc (mobi) ever. Just insert text-indent:0in; in whichever Style that you want to Flush left and you won't have to worry anymore
AThirstyMind is offline   Reply With Quote
Reply

Tags
html, kindle indent, style definitions


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie - keep original html and style Ray Tayek Calibre 7 12-01-2010 02:11 PM
Import of HTML With Embedded <Style> Broken In 0.7.5 Oboe Joe Calibre 2 06-27-2010 10:35 AM
HTML to .MOBI: large l.h. margin; text cuts off on the rt. Ideas how to fix? thorn Calibre 1 02-21-2010 01:47 AM
Changing default text style? jyavenard Kindle Developer's Corner 5 09-29-2009 09:38 AM


All times are GMT -4. The time now is 03:01 AM.


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