从Google Chrome打印时的页码 [英] Page Numbers when printing from Google Chrome
问题描述
我见过这个答案...
@page {
@ bottom-left {
content:counter(page)/counter(pages);
}
}
很多次,但它从不输出任何内容到页面对我来说,即使它应该工作。我尝试过在页面底部获得页码的创造性方式,但我永远无法使它可靠地工作。计数没问题,但位置总是关闭的,所以我放弃了它。
为什么这个CSS不能工作?如上所述,我正在使用Google Chrome进行打印。
您可以从这里尝试一个答案... 浏览器支持CSS页码
@page {
counter-increment:page;
counter-reset:page 1;
@ bottom-left {
content:计数器(页面)的页面计数器(页面);
$ b 因为它说明了这个答案,你需要重置一个使用它之前的计数器(根据 https://developer.mozilla.org/ zh-CN / docs / CSS / Counters )
I've seen this answer...
@page {
@bottom-left {
content: counter(page) "/" counter(pages);
}
}
many times, but it never outputs anything to the page for me, even though it's supposed to work. I've tried 'inventive' ways of getting page numbers at the bottom but I can never get it to work reliably. The count is fine, but the location is always off, so I've scrapped it.
Any reason why this CSS shouldn't be working? As stated, I'm printing with Google Chrome.
解决方案 There is an answer you could try from here... Browser Support for CSS Page Numbers
@page {
counter-increment: page;
counter-reset: page 1;
@bottom-left {
content: "Page " counter(page) " of " counter(pages);
}
}
As it states on that answer, you need to reset a counter before using it (according to https://developer.mozilla.org/en-US/docs/CSS/Counters)
这篇关于从Google Chrome打印时的页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!