![]() |
#31 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,872
Karma: 8821117
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Quote:
In conclusion, and for an epub3: With a xhtml code of: Code:
<p class="autoImg"><img alt="Hello" src="../Images/Hello.jpg"/></p> Code:
.autoImg { text-indent: 0; text-align: center; max-height: 4em !important; width: auto !important; margin: 0; } .autoImg img { max-width: 100%; margin: 0 auto; border: 1px solid red; display: block; } a) if the window is narrower than would accommodate a 2em height and proportional width (e.g. the WINDOW width is equivalent to 11em), the image is shrunk to fit the screen width-wise, maintaining a proportional height (i.e. resulting in an image that functionally has a height of 1.8333em and a width of 11em). b) if the window is wider than the proportional width of the image at a height of 2em (e.g. 14em wide), it will honor the 2em height with proportionaly width (resulting in 1em of white space to the left and right of the image). c) if the window matches the proportional width of the image at the defined 2em height, it would would look like scenario a, except the image would be exactly 2em (as defined) rather than shrinking to fit the window. I add a border to the image so you can understand better the things. As you can see, you have everything you asked for. PS: I worked with a height of 4em (and not 2em) as you stated in one of your first posts. Last edited by RbnJrg; Yesterday at 09:20 PM. |
||
![]() |
![]() |
![]() |
Tags |
image height, image scaling |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
line-height is fixed? | nano5 | Viewer | 5 | 01-25-2025 08:01 AM |
Image height | JSWolf | KOReader | 6 | 03-29-2021 04:29 PM |
QT5 and image height | Turtle91 | Sigil | 23 | 02-21-2013 01:44 PM |
Image height in div | soparch | ePub | 5 | 03-29-2012 01:18 PM |
What image height causes images to fill the screen? | karenbryant | ePub | 7 | 01-04-2012 04:23 AM |