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?
img hisrc=to get the image sizes to behave, but you can't do that any more. DX formatting is primitive enough that it doesn't bother me, anyway. I'll have to check on ADE tomorrow, I'm afraid--it's late here. Odd that it doesn't work, though. – Tom May 15 '14 at 06:49<div class="image"><img /></div>and css that specifiesdiv.image { margin: 1em 30%; width: 40%; } img { width: 100%; }and it works fine in ADE for me. Try running your CSS file through a validator to be sure there's no stray characters screwing up the CSS file. I've had a : instead of a ; screw up the entire CSS file in ADE before. – Tom May 15 '14 at 18:20widthstatement applies to the width of whatever is containing the thing that you're setting thewidthon. So the<div>is set to 40% as wide as the page. That leaves 60% left over. You take up that 60% by giving a 30% margin on each side of the div. The 1em margin on top and bottom is just to give a little extra space. The image itself is set towidth: 100%;so it takes up the entire width of the div that it's inside. Oh, and yes, feel free to center text withtext-align: center;. – Tom May 15 '14 at 22:02