2014-06-23 79 views
0

我需要打印网页内容(HTML/CSS)。我需要做的一件事是打印一些东西(页码,文档标题)除了第一页打印页面:仅在第二页上显示内容?

有没有办法让div(或其他元素)只出现在Pages> = 2上?

我没有任何手动分页符

jQuery的可用于

回答

0

的CSS @page指令与:first应用CSS到HTML打印

我举一个例子的第一页与#header#footer可能会暗示你

@media print { 
    @page { 
     /* Styles for every page other than first page */ 
     #header { 
      position: fixed; 
      display: block; 
      top: 0; 
     } 
     #footer { 
      position: fixed; 
      display: block; 
      bottom: 0; 
     } 
    } 
    @page :first { 
     /* override the styles for the first page */ 
     #header { 
      display: none; 
     } 
     #footer { 
      display: none; 
     } 
    } 
}