I modified a CSS page-numbering solution for my web page.
It automatically shows "Page 1", "Page 2", etc. I'd like it to show "Page 1 of 5", "Page 2 of 5", etc.
Here's my current example code: (Demo)
@media print {
thead span.page-number:after {
counter-increment: page;
content: "Page " counter(page) " of ?";
}
}
HTML: (pardon me for using tables, rather than CSS display: table-header-group
)
<table>
<thead>
<tr>
<td>
<span class="page-number"></span>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
..............................................................
</td>
</tr>
</tbody>
</table>
Is there any way to add the total page count in place of my ?
?
I'm only interested in the latest version of either Firefox or Chrome.
My current solution so far was to use the server to create one element per page, but it is much more difficult to get optimal page breaking that way. The <thead>
solution is much simpler.