Forum How do I...?

how to reduce whitespace with images?

hughmcguire
Is there a way -- prince magic, or CSS to address the following?

* PressBooks generates HTML containing arbitrary images (with known markup)...

* in web & epub reflowing means we don't care about pagination & whitespace ... so if we put an image between 2 paras, we can expect it to stay there & don't need to make any adjustment.

* however in print, there is an expectation that images will be placed in such a way to minimize whitespace ... either by:

a) adjusting the image placement on the page
b) adjusting image size
c) adjusting what text is "before" and "after" an image

in the below examples, you can see that images are put "where we told them to be put" relative to the text ... but the result is whitespace before page breaks.

screencaps:



and



Any ideas of how to solve?
mikeday
You can make the image a page float by applying "float: prince-top-if-necessary". This will take the image out of the normal flow and float it to the top of the page, but only if it would otherwise cause a page break.
hughmcguire
thanks.!
hughmcguire
have done some testing with
float: prince-bottom-if-necessary
... results look very good. thanks.