【问题标题】:How to show Page # in HTML footer of table如何在表格的 HTML 页脚中显示页码
【发布时间】:2021-07-09 17:51:47
【问题描述】:

我正在尝试在 Chrome 中的表格页脚中显示页码。但是当我实现下面显示的 Counter 示例的 CSS 代码时。我没有显示页码。它给了我在所有页面上重复的相同数字。

我尝试了以下代码

<table>
<thead>
    some header here...
</thead>
<tbody>
    some rows here....
<tbody>
<tfoot>
    <div id="#pageFooter"></div>
</tfoot>    

使用 CSS

table{
 counter-reset: page;
}
tfoot{
 display: table-footer-group;
}
#pageFooter:after{
 counter-increment: page;
 content: "Page " counter(page);
}

我也试过这种方法

@page {
@bottom-left {
 content: counter(page)
 }
}

请帮我找出解决办法

【问题讨论】:

  • 你打错了,是id="pageFooter" 没有#

标签: html css printing


【解决方案1】:

counter-reset: page;&lt;table&gt; 移动到您的 &lt;body&gt; 标记。

body{
    counter-reset: page;
}

【讨论】:

    猜你喜欢
    • 2012-03-29
    • 2020-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-30
    • 1970-01-01
    • 1970-01-01
    • 2017-09-05
    相关资源
    最近更新 更多