View Single Post
Old 08-16-2014, 03:19 PM   #5
Psymon
Chief Bohemian Misfit
Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.Psymon ought to be getting tired of karma fortunes by now.
 
Psymon's Avatar
 
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
Heh, I figured it out! Before, while searching for an answer, I'd been using "center image epub" as my query (and here in these forums I just used "center image"), neither of which seemed to give me a solution that worked. A short while ago, though, I tried searching instead just for "center image css", and that led me to something that does work just perfectly!

I've only tried this out on my iPad so far, but what I ended up using was the following.

For my CSS I used...

img.ornament {
width: 38%;
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 0.38em;
margin-bottom: 0.38em;
}

...and my image tag...

<p><img alt="Ornament" class="ornament" src="../Images/ornament-black.jpg" /></p>

I tried using "0" for my top/bottom margin, that that only seemed to end up giving me the same issue as before -- i.e. the top margin invariably ended up bigger than the bottom margin (and I have no idea why) -- but just bumping it up a bit seemed to do the trick.

I don't quite understand why this works and my earlier experiments didn't, but hey, it works! That's all that matters.
Psymon is offline   Reply With Quote