Kindle Fire Format

The Kindle Fire introduced a new format called kf8. This format has much broader support of HTML and CSS standards than the older MOBI format. It supports most standard HTML and CSS elements as well as a good portion of the new HTML5 and CSS3 elements. At the present time the Kindle Fire, the new Kindle, and the Kindle Touch support kf8 as well as MOBI. The older Kindles only support the MOBI format. The new Kindlegen program and the new Kindle Previewer support both the kf8 and MOBI formats. There are, however, a few compatibility problems. For example, the Kindlegen program no longer supports negative values for the width property. Using negative values for width in a paragraph was a common way to produce hanging indents. Hanging indents are now produced by using negative values for the CSS text-indent property. However, the text-indent property is handled differently in the Kindle Fire and older Kindles. To handle cases such as this, Amazon provided two new media queries. Any CSS code inside of @media amzn-kf8{…} applies only to the Kindle Fire. Any CSS code inside of @media amzn-mobi{…} applies only to the older Kindles. Below is an example of how to use a class hang to produce a hanging indent

@media amzn-kf8{ p.hang {text-align: left; left-margin: 2em; text-indent: -2em;} }

@media amzn-mobi{ p.hang {text-align: left; text-indent: -2em;} }

The not modifier can also be used with the media queries, i.e.,

@media not amzn-kf8{…}

@media not amzn-mobi{…}

Unfortunately, there is nothing corresponding to media queries for HTML code.