2011-08-26 36 views
4

我使用下面的CSS代碼到我的頁腳在頁面的底部位置:申請保證金運行CSS位置

<style type="text/css"> 
    @page { 
     @bottom-center { content: element(footer); } 
    } 
    #footer {position: running(footer);} 
</style> 

有沒有顯示它略高的方法嗎?添加margin-bottom: 50px似乎沒有效果。

更新:網頁會利用iText

回答

4

我終於設法得到它與下面的CSS工作:

<style type="text/css"> 
     @page { 
      margin-bottom: 100px; 
      @bottom-center { 
      content:element(footer); 
      } 
     } 

    #footer { 
     position: running(footer); 
    } 
</style> 

此前,我只試圖添加margin-bottom到@ bottom-center和#footer。

0

爲了實現這一轉換成PDF,您通常使用:

#footer { 
    position: absolute; 
    bottom: 50px; 
} 

jsFiddle example

+1

感謝您的建議,但這種方式導出到PDF(iText)時無法正確顯示。 –

+0

這是一個打印問題,作者提供了大量示例來闡明 – rainabba