【问题标题】:Fixed Header on every printed page and avoid page break inside in Footer固定每个打印页面上的页眉,并避免页脚内部出现分页符
【发布时间】:2021-07-31 00:48:59
【问题描述】:

我的页面中有三个Div,分别是invoiceHeader、invoiceBody 和invoiceFooter。我想在每个打印页面上重复第一个 div (.invoiceHeader),并且我想避免在打印时在第三个 Div (.invoiceFooter) 内部分页,页面上将没有页脚。我该怎么做?

【问题讨论】:

  • 分享您的代码以更好地理解

标签: html header page-break-inside


【解决方案1】:

以下代码可以帮助您作为粘性页眉和页脚进行打印

@media print { 
    .centerDiv{
        width: 80%;
        margin: 0 auto; /* Center the DIV horizontally */
    }
    .fixed-header, .fixed-footer{
        width: 100%;
        position: fixed;    
    }
    .fixed-header{
        top: 0;
    }
    .fixed-footer{
        bottom: 0;
    } 

}

【讨论】:

    猜你喜欢
    • 2023-03-17
    • 1970-01-01
    • 2013-12-01
    • 2014-06-02
    • 2016-12-18
    • 2020-02-06
    • 2014-11-17
    • 2018-10-13
    • 2012-01-11
    相关资源
    最近更新 更多