dvschultz / 99problems

99 Problems and e-reader rendering are all of them
60 stars 3 forks source link

iBooks Desktop wraps naked <img>s in very messy <div>s #26

Open dvschultz opened 10 years ago

dvschultz commented 10 years ago

it’s possible this also affects iBooks for iOS, but it’s impossible to test without an inspector.

If you add an <img> into a chapter without it being wrapped in a <figure> (or div?) iBooks for Mavericks will wrap it in a <div>, move your CSS applied to the img to that div and add a host of inline styles to your img

screenshot 2014-06-25 15 13 15

screenshot 2014-06-25 15 20 35

the solution is to wrap it in a div in your xhtml. this will give you more control over its styling and avoid messy inline styling:

screenshot 2014-06-25 15 29 48

dvschultz commented 10 years ago

actually, upon further inspection, iBooks always does this when an image is set to display: block