2
我有多个动态填充的表格。在打印页面上添加动态页面的标题
我想在打印模式下的每个页面上打印页眉,但是当表格行不适合页面打印在下一页上时,我的页眉会打印在页面上。 这样的:This is my print preview
我该如何设置页眉和页面数据之间的边距?
我搜索了很多,但似乎没有工作,甚至位置:固定不按预期工作。
@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...
是的,我试过了,tnx但不幸的是不起作用 –
@SaMirakf我试过了。当删除'position:fixed;顶部:10px;'它的工作。 –
如果我删除位置:固定标题将打印在一个页面上,而我想每页 –