View Single Post
Old 05-16-2015, 04:12 AM   #4
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
For epubs most of the device settings are set in the body element (using !important). If you have a stylesheet like this:
Code:
body {line-height: 1.5;}
p {text-indent: 1em;}
then the line spacing set from the device will override the one set in the body, and the paragraph p will inherit its line-height from body, and everything will work as you expect.

But there is a problem with the way that Calibre creates epubs. When Calibre converts a book with the stylesheet above, it creates class for body like:
Code:
.calibre {line-height: 1.5;}
and then uses it in the html like this:
Code:
<body class="calibre">
which then overrides the device setting in body because Calibre has increased the specificity of the styles.

What you need to do with Calibre-created/converted books is to remove the settings such as line-height from the .calibre class and specify them directly in body as the first example above.

Edit: The above applies to the EPUB reader, which interprets !important differently than the KEPUB reader.

Last edited by GeoffR; 05-16-2015 at 04:26 AM. Reason: ... applies to the EPUB reader ...
GeoffR is offline   Reply With Quote