How to add headers and footers to each page of a printed HTML document?
P粉256487077
P粉256487077 2023-08-20 14:58:06
0
1
790
<p>Is it possible to print a custom header and footer HTML page on every printed page? </p> <p>I would like to add the words "UNCLASSIFIED" in red, Arial font, 16pt size, to the top and bottom of every printed page, regardless of content. </p> <p>To clarify, if the document is printed to 5 pages, each page should have custom headers and footers. </p> <p>Does anyone know if this can be achieved using HTML/CSS? </p>
P粉256487077
P粉256487077

reply all(1)
P粉950128819

If you want to set the element you want to be a footer to position:fixed and bottom:0, when the page prints, it will repeat the element at the bottom of every printed page. For the header element, just set top:0.

For example:

<div class="divFooter">UNCLASSIFIED</div>

CSS:

@media screen {
  div.divFooter {
    display: none;
  }
}
@media print {
  div.divFooter {
    position: fixed;
    bottom: 0;
  }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template