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
668

Is it possible to print a custom header and footer HTML page on every printed page?

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.

To clarify, if the document is printed to 5 pages, each page should have custom headers and footers.

Does anyone know if this can be achieved using HTML/CSS?

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:

UNCLASSIFIED

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
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!