What I have is a <table>
it can be big or small sometimes only on one page and sometimes it can grow to be 10 pages and so.
Here is a sample code:
div{
position:relative;
height:100vh;
}
.table-blue{
width:100%;
background:lightblue;
}
.table-blue td{
padding:5px 10px;
}
.table-blue-fotter{
position: absolute;
bottom: 20px;/* for bottom gap */
left: 0px;
width:100%;
background:gray;
}
@media print {
.table-blue-fotter{
position: fixed;
bottom: 20px;
left:0px;
width:100%;
background:gray;
}
<div>
<table class="table-blue">
<tr>
<td>one</td>
<td>one test</td>
</tr>
<tr>
<td>two</td>
<td>two test</td>
</tr>
<tr>
<td>three</td>
<td>three test</td>
</tr>
</table>
<table class="table-blue-fotter">
<tr>
<td>one</td>
<td>one test</td>
<td>one test</td>
</tr>
<tr>
<td>two</td>
<td>two test</td>
<td>one test</td>
</tr>
<tr>
<td>three</td>
<td>three test</td>
<td>one test</td>
</tr>
</table>
</div>
Fiddle for property inspection - this workes good for me. But if the table gets long the story will change to this.
In the second view when the first <table>
gets long, in the print view the footer appears on every page.
So what I want is to the .table-blue-fotter
to appear only on the last page of the print view in the page bottom edge no matter the content height is.
only on Last page
Hopping for a CSS
fix.
Try print mode in chrome and you can see that the footer now appears on the last page only at the bottom of the page. position: fixed in print mode makes the footer appear on all the pages at the bottom of every page. Here is the full screen view of the fiddle result. fiddle.jshell.net/ur6d1h21/12/show.
You can do that by putting a Section Break (Menu Bar > Insert > Break... > Section Break Next Page) at the end of the page prior to the last page of the document. Make sure the last page's footer is Unlinked from the prior page's footer. You do that from the Header and Footer contextual ribbon tab in the Options Group.
CSS “Always on the bottom” Footer This is to prevent the footer from overlapping the content above it, since it is being removed from the document flow with position: absolute; . This footer will always be positioned at the bottom of the page, but not fixed.
Update following way:
@media print {
.table-blue-fotter {
position: static; /* <-- Key line */
bottom: 20px;
left: 0px;
width: 100%;
background: gray;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With