几个月前,当我使用以下代码在浏览器(firefox)中打印HTML文档时,能够显示页码:
body {
width: 300px;
counter-reset: page;
}
#header {
border: 1px solid;
overflow: hidden;
}
#header>div {
float: left;
width: 50%;
line-height: 100px;
text-align: center;
}
#foot {
border: 1px solid;
}
#header p {
margin: 0;
}
#header #pagenum {
border-left: 1px solid;
width: calc(50% - 1px);
}
@media print {
.pageBreak {
page-break-before: always;
padding-bottom: 120px;
}
#content {
padding-top: 120px;
}
#header {
display: block;
position: fixed;
top: 0pt;
left: 0pt;
right: 0pt;
}
.pagenum:after {
content: "Page " counter(page);
counter-increment: page;
}
#foot {
display: block;
position: fixed;
bottom: 0pt;
}
}
@media screen, handheld {
#header {
display: none;
}
#foot {
display: none;
}
}
Header
This is the page 1
This is the page 2
This is the page 3
This is the page 4
Foot Notes
可以在Firefox 45.7.0中使用。 由于最后一次Firefox更新几个月后,它不再工作了。 我目前使用的是Firefox Quantum 69.0。 我的问题:1.是否不再受支持? 2.打印html文档时,如何在每页上显示正确的页码?
最好的祝福