繁体   English   中英

用于打印的固定页脚未占据整个页面宽度

[英]fixed footer for print not taking full page width

我有一个隐藏的页脚,在打印页面时会显示出来,但是当我尝试在chrome上打印时,它不会占用整个页面的宽度。 为什么?

我正在使用的代码

 <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> 

使用固定位置和绝对位置时,需要指定宽度。

div.divFooter {}添加width: 100%

尝试添加此CSS

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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