通过Mozilla,(Printing a document)
这会在每个打印页面上放置页眉和页脚。这在Mozilla中效果很好,但在IE和Chrome中效果不是很好。
Print sampleSection A
This is the first section...
Section B
This is the second section...
Heading for paged media
Page:
CSS:
/*** Print sample ***/
/* defaults for screen */
#print-head,
#print-foot {
display: none;
}
/* print only */
@media print {
h1 {
page-break-before: always;
padding-top: 2em;
}
h1:first-child {
page-break-before: avoid;
counter-reset: page;
}
#print-head {
display: block;
position: fixed;
top: 0pt;
left:0pt;
right: 0pt;
font-size: 200%;
text-align: center;
}
#print-foot {
display: block;
position: fixed;
bottom: 0pt;
right: 0pt;
font-size: 200%;
}
#print-foot:after {
content: counter(page);
counter-increment: page;
}