Forum Bugs

Large gap between header and long table

Johann
We have a simple page with a header (h3 in this example), immediately followed by a long table. To avoid a page break between header and table we give the CSS:
h3 { page-break-after:avoid; }


The table should break after table rows with class 'summary':

tr.summary { page-break-after:auto; }


The table breaks as expected and spans pages 2 and 3.
But between the header (on top of page 1) and the start of the table there is a huge gap!
Why is the first part of the table not located on the first page?

- - -
Johann

  1. LargeGaps.png79.4 kB
    Rendering of Prince:
mikeday
Are you applying "page-break-inside: avoid" to the table?
Johann
Yes indeed, I have table { page-break-inside:avoid; } in my CSS.
After removing that the table is positioned directly after the header!

Nonetheless, still think that the large gap should be avoided (shouldn't it?)

- - -
Johann

mikeday
Ideally yes it would, but currently Prince will try quite hard not to break things when "page-break-inside: avoid" is specified, so it will move it to the next page to get more space. In this case, that doesn't help! But in other cases it does, so it is a difficult problem.