I have a long table with hundreds of rows. To print the table headers on each page, I am using THEAD {display: table-header-group} to style the table. And it works as expected in Firefox and IE9. But when I try to force the page breaks as shown in below code, it doesn't work in IE9. With IE9, the table headers get printed only the pages where the table breaks naturally.
Here is the code snippet -
CSS:
@media print {
thead { display: table-header-group; }
}
HTML/PHP:
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<?php
foreach ($items as $item) {
echo " <tr> " ;
echo "<td>text</td>" ;
echo "<td>text</td>" ;
echo "<td>text</td>" ;
if ($condition) {
echo "</tr>" ;
echo "<tr style='page-break-after:always;'>" ;
echo "</tr>" ;
}
}
?>
</tbody>
</table>
Will greatly appreciate any help on this.
Thanks.