简体   繁体   中英

fixed footer for print not taking full page width

I have a hidden footer which is shown when printing a page, but when i try to print on chrome it's not taking the full width page. why?

The code i am using

 <style type="text/css"> @media screen { div.divhead { display: none; } div.divFooter { display: none; } } @media print { div.divFooter { position: fixed; bottom: 0; } } </style> 
 <div> <div> <div class="divhead"> <asp:Image ID="Image1" ImageUrl="~/Images/head.jpg" Width="100%" runat="server" /> </div> </div> <div class="content"></div> <div class="divFooter"> <asp:Image ID="Image2" ImageUrl="~/Images/footer.jpg" Width="100%" runat="server" /> </div> </div> 

You need to specify a width when using position fixed and absolute.

Add width: 100% to div.divFooter {} .

Try adding this CSS

body, html{
   padding: 0;
   margin: 0;
}

 @media print {
        div.divFooter {
            position: absolute;
            min-width: 100%;
            bottom: 0;
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM