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

前端 未结 20 1377
迷失自我
迷失自我 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:21

    Is this something you want to print-only? You could add it to every page on your site and use CSS to define the tag as a print-only media.

    As an example, this could be an example header:

    UNCLASSIFIED
    

    And in your CSS, do something like this:

    
    
    

    Finally, to include the header/footer on every page you might use server-side includes or if you have any pages being generated with PHP or ASP you could simply code it in to a common file.

    Edit:

    This answer is intended to provide a way to show something on the physical printed version of a document while not showing it otherwise. However just as comments suggest, it doesn't solve the issue of having a footer on multiple printed pages when content overflows.

    I'm leaving it here in case it's helpful nevertheless.

提交回复
热议问题