4
我有一個需要打印多行HTML表格的項目。我想在每頁頂部顯示thead
部分。我正在使用IE11瀏覽器。在打印時使用css重複每頁的標題
<style>
@media print {
#Header {
display: table-header-group;
}
table {
page-break-inside: auto;
}
tr {
page-break-inside: auto;
position: static;
}
}
</style>
<div class="tab-pane active " id="template">
<table>
<thead>
<div id="Header">
<table style="width: 100%; table-layout: fixed;" id="tbl_1" class="table table-bordered">
<tbody>
<tr id="1">
<td style="height: 18px; border:solid; " ></td>
<td style="height: 18px; border:solid; "></td>
<td style="height: 18px; border:solid; "></td>
<td style="height: 18px; border:solid; "></td>
</tr>
<tr id="2">
<td style="height: 18px; border:solid; "></td>
<td style="height: 18px; border:solid; "></td>
<td style="height: 18px; border:solid; "></td>
<td style="height: 18px; border:solid; "></td>
</tr>
</tbody>
</table>
</div>
</thead>
<tbody>
<div id="contents">
<!--more then 800 rows in table-->
</div>
</tbody>
</table>
</div>
這有幫助嗎? [HTML header/footer](http://stackoverflow.com/questions/1360869/how-to-use-html-to-print-header-and-footer-on-every-printed-page-of-a-document -w) – Whothehellisthat
您的HTML錯誤。表頭只是應該有行,而不是另一個表的div。我不需要和媒體CSS重複表頭。 –
您是否嘗試過將標頭ID設置爲位置:用頂部固定:0?我知道這適用於某些實現。 –