Home  >  Article  >  Web Front-end  >  How to remove header and footer in javascript

How to remove header and footer in javascript

藏色散人
藏色散人Original
2021-06-21 11:35:513152browse

How to remove headers and footers in JavaScript: First use the window.print() function in JavaScript to print the current page; then use CSS to control the layout to remove the headers and footers.

How to remove header and footer in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

How to remove header and footer in javascript?

Written in front

Today’s development encountered the function of using the window.print() function to print the current page, because the url is displayed on the left part of the footer, which cannot exist , has been solved, written here.

Text

Many methods on the Internet cannot be used. Finally, I found a method to use css to control the layout to remove the header and footer

<style> @page { size: auto;  /* auto is the initial value */ margin: 0mm; /* this affects the margin in the printer settings */ }
</style>

Finally

Personal test, Google, IE can solve it

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of How to remove header and footer in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn