[英]Using CSS or JavaScript to count number of page breaks
I have a very big HTML screen which when you print, prints over 16 pages so in Print Preview you can see page breaks. 我有一个很大的HTML屏幕,当您打印时,它可以打印16页以上,因此在“打印预览”中您可以看到分页符。 I am trying to display the page number like this: Page X of Y 我试图显示这样的页码:Y的第X页
So display the page number out of the total number of pages and I am trying to display this in a footer that I created see below 因此,请显示总页数中的页码,而我尝试将其显示在我创建的页脚中,如下所示
<!--New Footeer-->
<div id="footer">
<p>Page X of Y</p>
</div>
<!--End New Footer-->
But is there a way in either CSS or JavaScript which I can use to achieve this? 但是在CSS或JavaScript中是否有一种方法可以用来实现此目的? Eg a way to count page breaks? 例如一种计算分页符的方法?
Try this: 尝试这个:
@page {
@bottom-right {
content: counter(page) " of " counter(pages);
}
}
This will print out what you want just with CSS 这将仅使用CSS打印出您想要的内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.