【发布时间】:2017-02-25 08:08:13
【问题描述】:
我有多个动态填充的表格。
我想在打印模式下在每一页上打印页眉,但是当表格行不适合页面时,它们会打印在下一页上,而我的页眉会打印在上面。 像这样:This is my print preview
如何设置页眉和页面数据之间的边距?
我搜索了很多,但似乎没有任何效果,甚至 position:fixed 也没有按预期工作。
@page {
size: A4;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-top: 0px;
}
@media screen {
.header {
display: none;
}
}
@media print {
.header {
position: fixed;
top:10px;
width:100%;
margin:10px;
border: 3px solid #000;
}
}
HTML 示例:
<table class="header">
<tr>
<td>
This is my header table
</td>
</tr>
</table>
<table>
....
</table>
<table>
....
</table>
and more...
【问题讨论】:
标签: html css printing header print-preview