is it possible to force table and its first row of content to be on the same page when printing it? This problem arises when there are some other contents preceding the table. The table looks something like the following:
<table>
<caption>
Title of the table
</caption>
<tbody>
<tr>first row</tr>
<tr>second row</tr>
<---more rows--->
</tbody>
</table>
Anyone knows how to force the table and its first row (or first few rows) of content to be on the same page when printing? I tried to mask the title and its first few rows with a div (with a height of let's say 200px
, and page-break-inside: avoid
used), this works but it vertically expands the parent container by 200px (only one table needs masking when i was testing with a dummy webpage) and introduces a blank page.
Jsfiddle for when no masking is applied: https://jsfiddle.net/8pk5L3jz/29/
This is the link to the jsfiddle that describes my problem, the added div.mask
causes the container of the table to expand by 200px, so it may potentially results in an empty page (it did in my dummy example): https://jsfiddle.net/8pk5L3jz/26/