[英]How to make the header and footer without repeating in print for N pages?
I'm struggling to repeat the header and footer on each print page. 我正在努力在每个打印页面上重复页眉和页脚。 No problem necessarily be a table, most like it was, someone has any idea how to do?
没有问题必然是一张桌子,大多数人都喜欢,有人知道该怎么做? And i dont know how many pages it will be, can be n pages.
我不知道它会有多少页,可以是n页。
Well since no-one seems to think it is a dup, I will post the code here to prove it. 好吧,因为似乎没有人认为它是一个重复,我会在这里发布代码来证明它。 See a working example here http://ab-smith.com/
请参阅此处的工作示例http://ab-smith.com/
html HTML
<h1>test 1</h1>
<h1>test 2</h1>
<h1>test 3</h1>
<h1>test 4</h1>
<h1>test 5</h1>
<h1>test 6</h1>
<div class="divFooter">
<h1>Footer</h1>
</div>
<div class="divHeader">
<h1>Header</h1>
</div>
CSS note I added a page break in between each of the <h1>
to simulate multiple pages CSS 注意我在每个
<h1>
之间添加了一个分页<h1>
来模拟多个页面
@media print {
h1 {
page-break-after: always;
}
div.divFooter {
position: fixed;
bottom: 0;
}
div.divHeader {
position: fixed;
top: 0;
}
body > h1 {margin-top: 100px;}
}
@media screen {
div.divFooter, div.divHeader {
display: none;
}
}
HTML and CSS have no support for printing page header and footers in print. HTML和CSS不支持打印页面页眉和页脚。 You may be able to simulate it with:
您可以使用以下方法进行模拟:
This solution have each bug and caveat in different browser. 此解决方案在不同的浏览器中有每个错误和警告。
See : How to use HTML to print header and footer on every printed page of a document? 请参阅: 如何使用HTML在文档的每个打印页面上打印页眉和页脚?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.