2015-11-05 59 views
0

打印頁面時顯示隱藏頁腳,但是當我嘗試在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>

回答

0

你需要指定一個寬度使用位置固定的和絕對的時候。

width: 100%加到div.divFooter {}

+0

我仍然有問題 – user5109118

0

嘗試加入這個CSS

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

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

我仍然有問題 – user5109118

+0

嘗試使用''位置:absolute'',我的答案更新。 –

+0

它需要全部寬度,但頁腳移動到頁面頂部 – user5109118