View Single Post
Old 10-05-2012, 07:37 PM   #180
jobalcaen
Junior Member
jobalcaen began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2012
Location: Winnipeg, Canada
Device: Sony PRS-505
This is the code I use to center images that have width's set as percentages:

<div class="imagecentre"><img alt="a horse" src="../Images/pic0001.png" /></div>

div.imagecentre
{
margin-left: 25%;
width: 50%;
}

div.imagecentre img
{
width: 100%;
}

Quote:
When setting a relative image width (such as 50%), create a left margin that is half of the remaining page width. In the example below the image width is 50% of the screen so the left margin is set to 25%.
I found the code at http://adamdscott.com/wrote-about/re...ges-in-ibooks/ and have tested it on: Ibooks, Sony PRS-505, ADE and the firefox epubreader.

At first it seemd like a simple fix but it was hard finding a solution that worked reliably on so many readers.

Last edited by jobalcaen; 10-05-2012 at 07:40 PM.
jobalcaen is offline   Reply With Quote