How to use HTML to print header and footer on every printed page of a document?

前端 未结 20 1375
迷失自我
迷失自我 2020-11-21 16:51

Is it possible to print HTML pages with custom headers and footers on each printed page?

I\'d like to add the word \"UNCLASSIFIED\" in Red, Arial, size 16pt to the t

20条回答
  •  遇见更好的自我
    2020-11-21 17:18

    @Daniel made a comment on the question in 2012 about the lack of support for the CSS3 features: top-center & bottom-center.

    Well, In Chrome 73+, the following snippet works, where header and footer are

    and
    elements defined within the page.

    @page {
        @top-center { content: element(header) }
    }
    @page { 
        @bottom-center { content: element(footer) }
    }
    

提交回复
热议问题