![]() |
#1 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 86
Karma: 12586
Join Date: Nov 2012
Device: Ipad and Kindle Fire
|
Preventing images breaking across pages
Being frequently plagued by the problem of images breaking over the page in iPad and on kindle, I am looking for the best way to avoid this.
I place the images in div tags with the css rules: page-break-inside:avoid !important; and as appropriate with page-break-before:always; and /or page-break-after:always ; But if the image is tall and thin, there is always the possibility that it will break over to the next page, especially in landscape. It seems to help if the image is of similar proportions to the screen e.g. 860px by 600px but this is not always the case. For large images, I have also tried using : } img { max-height:97%; } Nothing seems to be full proof, i wonder if anyone has better ideas how to prevent images breaking. |
![]() |
![]() |
![]() |
#2 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
page-break is not a good css rule for these things, just out of experience, I don't know why it doesn't work really.
If you set the image width to 100% it should fit to screen, no div, wrappers or anything, just add css rule for Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 86
Karma: 12586
Join Date: Nov 2012
Device: Ipad and Kindle Fire
|
[QUOTE=odedta;2821123]page-break is not a good css rule for these things, just out of experience, I don't know why it doesn't work really.
If you set the image width to 100% it should fit to screen, no div, wrappers or anything, just add css rule ... This will make the width of the image fit to screen - I use it regularly, but you can still have problems with tall thin images. |
![]() |
![]() |
![]() |
#4 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
For us with older devices, using giant images is going to make for very slow files to open and process and un-uploadable here since the limit is 20 Meg.
|
![]() |
![]() |
![]() |
#5 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | ||
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Your solution:
Add class image to the wrapper <p> tags of your image. e.g. Quote:
Quote:
I've only checked it on the first tall image I encountered because i'm in a hurry today, it should work for the rest. |
||
![]() |
![]() |
![]() |
#7 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 86
Karma: 12586
Join Date: Nov 2012
Device: Ipad and Kindle Fire
|
Quote:
Dear Odedta Yes the rule max-height works much better on the p wrapper ranter than on the image itself. Thanks for this. You mentioned some errors in Calibre but I can't get Calibre to indicate any errors, nor epubcheck. I usually just check with epubcheck rather than worrying about calibre, but if you found some errors I am not aware of, I would appreciate it if you told me what they were. Thanks |
|
![]() |
![]() |
![]() |
#8 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Some stuff about fonts and unsupported CSS rules, it's quite important to fix those, this is why I love Calibre check book feature, ePubCheck wouldn't tell you these things.
I attached an image with all the errors you get when running "Check Book" on the file you sent me. |
![]() |
![]() |
![]() |
#9 |
Scripler Project Lead
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19
Karma: 19304
Join Date: May 2014
Location: Copenhagen, Denmark.
Device: Gameboy Color
|
For tall thin images or tall images with captions I use the following CSS. It should work uniformly on ADE and iBooks and other devices.
First you need to wrap a div around your image HTML: Code:
<div class="tallImage"> <img alt="" src="../Images/image.jpg" /></p> </div> Code:
div.tallImage { width:80%; height:auto; page-break-inside: avoid; margin-left:10%; } img { max-width:100%; height:auto; } |
![]() |
![]() |
![]() |
#10 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 86
Karma: 12586
Join Date: Nov 2012
Device: Ipad and Kindle Fire
|
[QUOTE=Abekonge;2825193]For tall thin images or tall images with captions I use the following CSS. It should work uniformly on ADE and iBooks and other
And this CSS: Code:
div.tallImage { width:80%; height:auto; page-break-inside: avoid; margin-left:10%; } img { max-width:100%; height:auto; } What if you put 'Max-height:100%;' under the img tag above, instead of max-width? |
![]() |
![]() |
![]() |
#11 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Wouldn't CSS @media queries do the trick for the different proportions?
|
![]() |
![]() |
![]() |
#12 |
Scripler Project Lead
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19
Karma: 19304
Join Date: May 2014
Location: Copenhagen, Denmark.
Device: Gameboy Color
|
Well there is only trial and error, and after a lot of that, you can formulate best practice: If you take 100 tall images from books, most of them will be within a certain range (so sort your images into tall, wide and square). If you're captions are shortish, the css above should work for most. If things are different you have to tweak. In general images should not break on ibooks on ipad though, but you can add page-break-inside: avoid; on the img tag as well. Ibooks on OSX on the other hand is not to be trusted with anything
max-height:100%; severely f**** image-dimensions in Adobe Digital Editions. Also max-height, max-width are not support by kindle - it will not break a conversion - for specific kindle productions it is better to do without. @media is not supported by Adobe Digital Editions. You can do some things with @viewport though to emulate a bit of that - but it is not something I have tested rigorously. |
![]() |
![]() |
![]() |
#13 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
I sincerely hope kovid will come out with a stand-alone device ePub 3 reader so he can us of all this compatibility nonsense :P
|
![]() |
![]() |
![]() |
Tags |
epub, page breaks inside images |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Classic Split PDF pages into smaller pages (images into tiles) | Astro | Barnes & Noble NOOK | 4 | 06-12-2020 10:56 AM |
Pages Not Breaking | msmith65 | Sigil | 8 | 08-21-2012 12:32 PM |
Images spreading across two pages | michaelks | Conversion | 0 | 03-02-2011 12:42 PM |
pdf to epub/breaking up images? | dhume01 | Calibre | 1 | 07-06-2010 08:51 PM |
Images on Kindle; blank pages | joubert | Kindle Formats | 3 | 05-28-2010 03:49 PM |