Kindle and EPUB can often seem like siblings: one likes peas and the other likes carrots. When it comes to text-indenting paragraphs, the Kindle automatically indents each paragraph, and must be told when not to. Whereas EPUB's default is to have paragraphs full-out and to leave space between each.
This makes it tricky to find a solution that suits both. The most minimal way I have found is to add <p class="first"> to the beginning of each paragraph you would like full out - e.g. at the beginning of an article or chapter, after a heading or after a blockquote. Then link this to the following Kindle-only CSS:
p.first {
margin-top: 1 em;
text-indent: 0em;
}
It won't hurt the EPUB to leave the class attribute in the EPUB XHTML, but it is superfluous because I would recommend that all paragraphs are simply tagged using <p></p> and then the following CSS used:
p {
margin-bottom: 0.00em;
margin-top: 1.55em;
text-indent: 0.00em;
}
p + p {margin-bottom: 0.00em;
margin-top: 0.09em;
text-indent: 1.09em ! important;}
You can use the same method for controlling space after headings - e.g. (h1 + p) or before headings (p + h1) or after and before blockquotes (p + blockquote, blockquote + p). Note the order in which the elements are named dictates which one will have the style applied (it is always the latter) - but you can go on with this to p + p + p and so on.
EPUBs aren't fussy whether there is a space between the element and the + sign in the CSS, but Kindle is - it demands a space. That said, I wouldn't use this type of CSS at all with the Kindle because it doesn't know how to interpret it, and unlike EPUB doesn't have a methodical way of deciding which element gets the style applied - the first or the second - and so it does both and throws any style into disarray.
This makes it tricky to find a solution that suits both. The most minimal way I have found is to add <p class="first"> to the beginning of each paragraph you would like full out - e.g. at the beginning of an article or chapter, after a heading or after a blockquote. Then link this to the following Kindle-only CSS:
p.first {
margin-top: 1 em;
text-indent: 0em;
}
It won't hurt the EPUB to leave the class attribute in the EPUB XHTML, but it is superfluous because I would recommend that all paragraphs are simply tagged using <p></p> and then the following CSS used:
p {
margin-bottom: 0.00em;
margin-top: 1.55em;
text-indent: 0.00em;
}
p + p {margin-bottom: 0.00em;
margin-top: 0.09em;
text-indent: 1.09em ! important;}
You can use the same method for controlling space after headings - e.g. (h1 + p) or before headings (p + h1) or after and before blockquotes (p + blockquote, blockquote + p). Note the order in which the elements are named dictates which one will have the style applied (it is always the latter) - but you can go on with this to p + p + p and so on.
EPUBs aren't fussy whether there is a space between the element and the + sign in the CSS, but Kindle is - it demands a space. That said, I wouldn't use this type of CSS at all with the Kindle because it doesn't know how to interpret it, and unlike EPUB doesn't have a methodical way of deciding which element gets the style applied - the first or the second - and so it does both and throws any style into disarray.
Comments
Post a Comment