bell notificationshomepageloginedit profileclubsdmBox

10.01% popularity   0 Reactions

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.

For centering images and groups of text, I am using this block of css in ePUB

margin: 15px auto;
padding: 0;
text-align: center;

I read while researching that putting the left and right margins as auto and using text-align: center property has the effect of centering block-level elements but that it doesn't work on ADE and other readers based on it due to their inability to properly interpret the auto property. However, in my case, its working, both in ePUB and Kindle devices. Is this something I should be concerned about? Is the way I've done an alright way to do it?


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (1)

Login to follow story

More posts by @Sarah

1 Comments

Sorted by latest first Latest Oldest Best

10% popularity   0 Reactions

You will probably run into problems doing it that way, particularly on iBooks. The most reliable method I've found for centering is:

<div class="centered_image">
<img src="image.jpg" alt="Alternate text" />
</div>

With css like this:

div.centered_image {
width: 60%;
margin: 1em 20%;
}
div.centered_image img {
width: 100%;
}

On a very few reading systems (notably the nook), this can cause problems on some images due (I'm guessing) to rounding errors, so you may have to set the margins just a hair smaller (like 19% in the above example).


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (0)

 

Back to top