View Full Version : How to be sure a full page image+ caption is not split between 2 pages?


silviolorusso
06-10-2013, 09:37 AM
I tried page-break-inside: avoid, but no luck?

This is the css I currently use:


div.container {
page-break-before:always;
page-break-after:always;
page-break-inside: avoid;
}
div img {
height: 80%;
}

Jellby
06-10-2013, 10:21 AM
I tried page-break-inside: avoid, but no luck?

Well, that's the way (at least as long as image and caption fit the screen). If a particular ebook reader does not obey that, it's not your fault.

The only way to be (almost) sure no break will happen is including the caption into the image, but I'd never recommend that.

shoban1071
07-02-2013, 01:53 PM
If you include

display: inline-block;

in your container div that should nudge the reader to keep the image and caption together. beyond that make sure your image is small enough that it isn't pushing the caption onto the next page anyway.

Jellby
07-02-2013, 02:28 PM
But inline-block is not required by the ePub spec, so it's not the reader's fault if it doesn't work.

DaleDe
07-02-2013, 04:04 PM
setting page-break-after to avoid will often keep an image with its caption or putting them in the same block and using page-break-inside will work. So long of course it fits.

Dale

SBT
07-02-2013, 04:49 PM
My standard solution of second-to-last resort: SVG. Include the image and the caption (as text) inside the SVG.

Notjohn
07-04-2013, 05:06 PM
If I think the image is going to fill the screen on at least some e-readers (for example, on the e-ink kindle as opposed to the tablets) then I generally work the caption into the preceding paragraph.

Jellby
07-05-2013, 03:34 AM
If I think the image is going to fill the screen on at least some e-readers (for example, on the e-ink kindle as opposed to the tablets) then I generally work the caption into the preceding paragraph.

Since the Kindles do not read the ePub format directly, is that behaviour due to something in the ePub format or to some bug/feature of whatever converter is used to read it in the Kindles?

I don't want to be an anti-Kindle advocate (we already have our resident one), but I don't want to see ePub discussions hijacked by anti-ePub readers (Kindle and, to some extent, iBooks), either.

Notjohn
07-07-2013, 12:32 PM
Since the Kindles do not read the ePub format directly, is that behaviour due to something in the ePub format or to some bug/feature of whatever converter is used to read it in the Kindles?

Oh no, it's simply the dimensions of the Kindle screen. A "normal" vertical photograph is 8x10 inches, the size of a traditional sheet of printing paper. On the Fire, such an image has room for a caption below it, because the Fire is comparatively skinny. The older e-ink Kindles (and I think the newer ones as well) by contrast are fatter. 800x1000 pixels would just about fill the entire screen, pushing the caption to the next page.

This can work havoc in books with multiple images. I once read a library e-book in which for five or six consecutive pages there was a caption at the top of the page and a photograph below, and in each case the caption referred to the photo on the previous page. (Obviously my dodge of working the caption information into the preceding paragraph wouldn't have headed off that calamity, but it does in the books I publish, which typically have one image per chapter.)

DomesticExtremis
07-12-2013, 08:24 PM
This doesn't solve the original problem, but you could put the image and caption inside a <div> tag and then style the background to be some shade of grey, so that there is at least a visual clue as to which caption belongs to which image.