99problems icon indicating copy to clipboard operation
99problems copied to clipboard

iBooks ignores <img> height and width attributes

Open NickBarreto opened this issue 11 years ago • 6 comments
trafficstars

iBooks completely ignores attributes in an element, instead showing the image a it's full pixel size, or as large as it can be given the width of the current view.

NickBarreto avatar Mar 27 '14 16:03 NickBarreto

oh yeah this is a classic issue. I think the workaround is still wrapping it in an element (like <figure>) and setting the width on that, right?

dvschultz avatar Mar 27 '14 16:03 dvschultz

If I remember correctly, yes. Thought it's been a while since I last checked. It may require an additional max-width:100% on the img element so it doesn't just overflow outside the container figure

NickBarreto avatar Mar 27 '14 16:03 NickBarreto

yeah, that’s what I have in my base stylesheet as well.

dvschultz avatar Mar 27 '14 16:03 dvschultz

Reflowable design for iBookstore upload:

<img alt="DEST6100.jpg" class="cover" src="images/DEST6100.jpg" />

If you don't upload it:

<img width="auto" height="auto" alt="eposta1.PNG" src="../teytag/lup/resim/eposta1.PNG" />

teytag avatar Apr 01 '14 09:04 teytag

I'm not having any luck with these workarounds. Images ignore img max-width: 100% and width: 100% . Grrr!!

artbyrt avatar Apr 07 '16 15:04 artbyrt

solved it!! You need not only max-width: 100% on figure element but also a margin: 0; on the element. I keep finding that there does not seem to be the same inheritance structure in CSS for epub and I have to reiterate. While I zeroed out the margins on the body element this had to be done again on the image ... that doesn't seem right at all.

artbyrt avatar Apr 07 '16 18:04 artbyrt