小编joh*_*ter的帖子

如何使用反增量在打印的网页上显示页码?

我有以下CSS:

@media print {
    div.question-list-footer
    {
        position: fixed;
        bottom: 0;
        padding-left: 180px;
    }
    div.question-list-footer-center 
    {
        text-align: center;
    }
    @page { counter-reset: page 1}
}

#pageNumber:after { content: counter(page); }
#pageNumber { counter-increment: page; }
Run Code Online (Sandbox Code Playgroud)

以及我页面上的以下html:

<div class="question-list-footer">
    <div class="question-list-footer-center">
        <span>Page Number: <span id="pageNumber"></span></span><br/>
        Date: @firstItem.Date.Value.ToShortDateString()
        Id: @firstItem.Id
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

这在打印时有效,除了所有页面都有"页码1".(IE9,Chrome和FF)我一直盯着这个并且玩了很久但仍然看不出原因.有人有修复吗? - 请告诉我这不明显.(FWIW - Chrome不喜欢我的底部).

html css printing

7
推荐指数
1
解决办法
6793
查看次数

标签 统计

css ×1

html ×1

printing ×1