The KF8 Format

In 2004 Amazon 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. The Kindle Previewer supports both the KF8 and MOBI formats. There are, however, a few compatibility problems. For example, negative values for the width property are no longer supported. 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 in KF8 and MOBI documents. To handle cases such as this, Amazon provided two new media queries. Any CSS code inside of @media amzn-kf8{…} applies only to devices that support the KF8 format. Any CSS code inside of @media amzn-mobi{…} applies only to the older Kindles that don't support the KF8 format. 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.

+++++