10

I am currently creating an ePUB3 file for converting it to Kindle format, and for it be compatible to other ereading devices that support epub.

I was confused about whether Kindle allows the font style of the body text to be changed via css or not.

While reading Amazon Publishing Guidelines, Text Guideline 3.1.1 says:

The body text in a reflowable Kindle book (fiction and non-fiction) must be all defaults. Amazon encourages content creators to use creative styles for headings, special paragraphs, footnotes, tables of contents, etc., but not for body text. The reason for this is that any styling on body text in the HTML will override the user’s preferred default reading settings. Users report such behavior as a poor reading experience.

While at the same time in Guideline 3.1.9 , it says:

The primary or main font in a book should be set at the level.

This seems to be a bit contradictory, the first one seem to say that we can't change the font style (I take it to include specifying font family as well), and the second one says we can, can we or can we not specify a body font ? Am I misunderstanding this in some way ?

Also, another confusion that I have is with regards to inserting indentation in paragraphs in the Kindle ebooks. The guideline concerning this goes like this in Amazon Publishing Guidelines:

KindleGen automatically indents the first line of every paragraph by default. To change this behavior, use the text-indent style on the <p> tag.

However, when I try to change the text-indent property to my <p> tags , just to check how it works, it has no effect whatsoever on the indent on the paragraphs, what could be happening ? And even with no text-indent added, it doesn't seem like Amazon is inserting any default indentation, I mean I can't see it while previewing in Kindle Previewer.

2 Answers 2

3

You can certainly specify custom fonts for Kindle books; that's what section 3.1.9 is all about. Section 3.1.1 is only talking about the things that it mentions:

  • Forced alignment (because Amazon would rather force the ancient print relic of justified text throughout)
  • Body text size
  • Bold and italics on body text
  • White or black color for body text
  • White or black background color for body text
  • Oh, and customers say they like being able to change fonts, so maybe think about that before deciding to include your own fonts

The last point is the only thing that talks about choice of typeface, and it's purely advisory. Note also that "body text" refers to the main text styling of the document, not any text that appears in the <body> of the document (which would obviously be everything).

As far as p.body {text-indent: 1.2em;} not working (that's my preferred value, anyway): I've not had that problem. If you can provide some of the relevant xhtml and css, I'd be happy to see if there are any errors I can spot. Using a CSS validator is also a great option.

2
  • Ah, got it! But won't main text styling apply to the entire text anyway ? Since I would be specifying the font family in the <body> tag ? Which it seems would apply it to all body tags in all xhtml files which would include all text won't it ? Text Indent is working now :) I was putting it zero and hoping to see indentation :D
    – QPTR
    Commented May 15, 2014 at 6:53
  • 1
    Oh, I specify fonts in p tags, myself, or whatever other tags are relevant. I generally prefer to not specify fonts at all, but some of our clients use typefaces to convey info, or even just have highly designed books, so they are using a number of different fonts.
    – Tom
    Commented May 15, 2014 at 6:58
2

As a best practice, avoid font-size, margin or other css instructions when creating an ebook.
An ebook is supposed to be just text and be made available to the device "as is". This allows the user to change the font family and size as he/she wishes.

I know, being familiar with PDF or the layout with a webpage in the beginning the tendency is to translate all visual effects to ePub/Kindle. But please, remember that an ebook reader focuses on the reading and nothing else.

As a conclusion: stop thinking at how to manipulate the body, titles or the paragraphs. Just use clean, simple html tags (h1, h2, h3, p and if you really wish, em or strong).

5
  • I agree that when possible clean html is the way to go, but some css for margin, size, etc is fine. Just make sure it's relative: 1.2em rather than 14px and so on. Also, make sure to use i and b unless you really mean emphatic or strongly emphatic.
    – Tom
    Commented May 15, 2014 at 6:29
  • I am using px for margins at several places, like for example margin top for <p> and <h1> tags, is it always better to use em ?
    – QPTR
    Commented May 15, 2014 at 6:57
  • 1
    If the device is well designed, the user will have the possibility to override the specifications from the publisher. The C in CSS stands for "cascading", after all.
    – mau
    Commented May 15, 2014 at 8:19
  • 1
    em represents relative sizes whilst px is expressed in fixed pixel size that can vary from one device to another so, yes, it's recommended to use em instead of px Commented May 15, 2014 at 8:34
  • 1
    @QPTR: Sorry I was unclear. For font sizes, em is the way to go, but you don't actually want your margins to scale, or you will find yourself with a narrow column of text down the middle of the page at large font sizes. Top and bottom margins tend to be less of an issue, so you can frequently use em for those without impacting readability. For something like an excerpt you could use margin:1em 20px for example.
    – Tom
    Commented May 15, 2014 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.