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?我知道这适用于某些实现。 –