Skip to content Skip to sidebar Skip to footer

Html Footer At The Last Printed Page

I want to print my html page. I have more than 1 page and I want print my footer only at the bottom of the last page. My css @page { size: 8.5in 11.0in; margin-left

Solution 1:

SOLVED: Below CSS code will show footer or any content only on the last page of PDF.

<styletype="text/css"media="print">@page {    
        size: A4 portrait;    
        padding-left: 8px;    
        padding-right: 0px;
        margin-top: 50px;
        margin-bottom: 150px;
    
        @bottom-center {width: 100%; content: element(footer)}
    }  
    
    @media print {
        .footer {
            left: 0;
            width: 100%;
            position: running(footer);
            height: 200px;
        }  
    }
</style><divclass="footer">
    Content Here
</div>

Solution 2:

To make it more simple you could position the footer within a media query for printing another way:

@media print { 
body {
  position: relative;
  }
#printfooter {
  position: absolute;
  bottom: 0;
  }
}

As a quick work-around suggestion. Or you use css3 with the @page extension:

@page:last {
    @bottom-center {
        content: element(footer);
    }
}

For further information w3 has a pretty good documentary about CSS Paged Media Modules. 5.3, Example 7 is the information your good to go with!

Hope one of this helps! If, or if not please let me know.

Best regards, Marian.

Post a Comment for "Html Footer At The Last Printed Page"