How To Print Page Number In Print Preview In Html Page Contains Table
here i have some of the tables , i need to print this html page, with page number,the table content may differ dynamically, i unable to print the page number dynamically ,I have t
Solution 1:
If you want you can use counter
body{
counter-reset: page;
}
.page-counter:after {
counter-increment: page;
content: "Page " counter(page);
}
<div class="page">
fake content
<div class="page-counter"></div>
</div>
<div class="page">
fake content
<div class="page-counter"></div>
</div>
If you want to use " page 1 / 10" you can create a div with spans inside of it equal to the number pages you have
body{
counter-reset: page;
}
#total-counter{
counter-reset: totalPages;
}
#total-counter span{
counter-increment: totalPages;
}
.page-counter:after {
counter-increment: page;
content: "Page " counter(page) " / " counter(totalPages);
}
<div id="total-counter">
<span></span>
<span></span>
</div>
<div class="page">
fake content
<div class="page-counter"></div>
</div>
<div class="page">
fake content
<div class="page-counter"></div>
</div>
Post a Comment for "How To Print Page Number In Print Preview In Html Page Contains Table"