发布于 2019-06-11 16:53:45
复制css并创建一个文件,在您css中调用css,并在chrome高级选项中的页眉和页脚上完成,将id="www"
提供给body
<script type="text/javascript">
function PrintPanel() {
var panel = document.getElementById("www");
var printWindow = window.open();
printWindow.document.write(panel.innerHTML);
printWindow.document.write('<link href="yourecss.css" rel="stylesheet" />');
printWindow.document.write('</body></html>');
printWindow.document.close();
setTimeout(function () {
printWindow.print();
printWindow.close();
}, 1200);
return false;
}
</script>
发布于 2019-01-31 13:27:04
.page{
counter-reset: page;
}
.page .page-number{
display:block;
}
.page .page-number:after{
counter-increment: page;
content:counter(page);
}
.page:after{
display: block;
content: "Number of pages: " counter(page);
}
<div class="page">
<span class="page-number">Page </span>
<span class="page-number">Page </span>
<span class="page-number">Page </span>
<span class="page-number">Page </span>
</div>
https://stackoverflow.com/questions/54453533
复制相似问题