Forum How do I...?

Can I -prince-float only when needed?

cayhorstmann
I was asked to reproduce the algorithm for figure placement in a book that goes as follows: If the figure fits on the page where it occurs, then put it there. Otherwise, float it to the next top. Is that doable with CSS or the prince extensions?
cayhorstmann
I hit upon unless-fit in the ancient post https://www.princexml.com/forum/topic/5022/selector-for-floated-elements, and it solved my problem:

-prince-float: snap unless-fit;

This is awesome, and an excellent default for figure placement in a textbook.

Suggestion: Include a hint in the documentation at https://www.princexml.com/doc/css-props/#prop-float-placement. Once I knew about it, search led me to https://www.princexml.com/doc/styling/#conditional-modifiers, but that's pretty hard to find otherwise.
csant
Suggestion:


Thanks, that is a very good suggestion, we'll make sure that it is included!