Forum How do I...?

collapse top margin on floating tables, figures

pieter.lamers
Can the top margin of potentially floating divs, containing tables, or figures automatically be collapsed when they float to the top of a page? or is there another way to have whitespace when the items appear in place, and collapse that when they are removed and floated onto the next page?

Also, can we have a different behavior of the <p> underneath the object, not indenting if the table is in place, and indenting if it is not?
mikeday
Are you using the "float" property to put them on the next page?

Unfortunately it is not possible for CSS to detect if the paragraph is preceded by a floating table, although it might be possible to do this (with some effort) using a JavaScript two-pass process, running Prince twice.
pieter.lamers
Hi Mike,
Thanks for the answer to the second question. As for the first one, the figure panel has the following style:

margin:1.285em 0;
float:top unless-fit;

We would like to collapse the margin-top if it does not fit. Do you know of a way to achieve that?
mikeday
Unfortunately not; we are planning to reconsider the way these "snapping" floats work, as currently it is difficult to achieve the desired layout.
pieter.lamers
Hi Mike, has there been any progress here, or would you otherwise have a solution which prevents manual intervention for every table or figure that gets bumped to the next page?
pieter.lamers
Hi Mike, has there been any progress here, or would you otherwise have a solution which prevents manual intervention for every table or figure that gets bumped to the next page?