Forum How do I...?

float: prince-top-if-necessary (What does this Do?)

milan
Hi,

I just saw this property on the Prince website "float: prince-top-if-necessary" and "float: prince-column-top-if-necessary", what does this do in terms of its been defined?

I tried to use these properties but result seems to have no effect at all.

my code looks like this:

<div style="float: prince-top-if-necessary">
<div style="column-count: 2; column-gap: 12pt;">
<p>content...</p>
<div style="float: prince-column-top-if-necessary"><img src="col-float-top.jpg" /></div>
<p>content...</p>
</div>
</div>


Am I doing something wrong here or this is not supported?

Any advice would be highly appreciated.

Thanks,
Milan
mikeday
They will only float if the block would otherwise leave an empty gap at the end of the page.
bookdev
Could you please be so kind as to let me know if it's possible to do:

img {float: prince-top-if-necessary;}

Or do I need to write a macro to surround each image with a <div style="float: prince-top-if-necessary;">?

When I try img {float: prince-top-if-necessary;} with Prince 8 it causes every image to float to the top even when not necessary.

I checked the documentation and searched the forum but couldn't find an answer.
mikeday
It seems that this occurs whenever the float property is applied to an inline or inline-block element. It can be avoided by applying "display: block" to the img element. We might be able to change this behaviour for Prince 8.1.
bookdev
OK. Thanks for the solution, Mike.