View Single Post
Old 05-01-2013, 06:17 PM   #24
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 47,053
Karma: 169810634
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by JSWolf View Post
Here is the code in the XML for displaying the image centered followed by the relevant CSS code...

Code:
<p class="image"><img alt="" src="2.jpg"/></p>
Code:
p {
    margin-top: 0;
    margin-bottom: 0;
    text-indent: 1.2em
}
.image {
    display: block;
    text-align: center;
    text-indent: 0
}
There nothing auto. There's no inline anything. There no workarounds. It just works.
Try using that to display a graphics drop cap or any other graphics inline with text, hence my preference for inline-block. I've seen a lot of epubs that try to display centered graphics by using code similar to the following:

Code:
.image  {
display: block;
margin-left: auto;
margin-right: auto;
}
This works until you meet a renderer that does not support the margin: auto directive. For whatever reason, Adobe is in that camp.

Also note the using text-align with graphics is not a recommended technique and should be avoided even though it works at least 95% of the time.

Regards,
David
DNSB is offline   Reply With Quote