我需要打印网络内容(HTML / CSS)。我需要做的一件事就是在每个页面上打印一些东西(页面编号,文档标题),但第一个。
有没有办法让div(或其他元素)只出现在Pages> = 2上?
我没有任何手动分页符
可以使用jQuery
答案 0 :(得分:0)
带有@page
的CSS :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;
}
}
}