【问题标题】:Printing a page: Content only on 2nd Page?打印页面:仅在第二页上的内容?
【发布时间】:2014-06-23 16:07:20
【问题描述】:

我需要打印网页内容 (HTML/CSS)。我需要做的一件事是在除第一页之外的每一页上打印一些内容(页码、文档标题)

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

我没有任何手动分页符

可以使用jQuery

【问题讨论】:

    标签: javascript jquery html css printing


    【解决方案1】:

    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;
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-06
      • 2021-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多