打印页面:仅在第二页上打印内容?

时间:2014-06-23 16:07:20

标签: javascript jquery html css printing

我需要打印网络内容(HTML / CSS)。我需要做的一件事就是在每个页面上打印一些东西(页面编号,文档标题),但第一个

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

我没有任何手动分页符

可以使用jQuery

1 个答案:

答案 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;
        }
    }
}
相关问题