Home > Article > Web Front-end > How to remove header and footer in javascript
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.
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!