简体   繁体   English

更改window.print()上的页眉和页脚

[英]Change header and footer on window.print()

I'm printing a html page with window.print() function. 我正在使用window.print()函数打印一个html页面。 I'm looking for a way to change the default header and footer witch appear on every page. 我正在寻找一种方法来更改每个页面上出现的默认页眉和页脚。 For header i want to delete it, and for footer i want to have a image that should appear on every page. 对于标题我想删除它,对于页脚我想要一个应该出现在每个页面上的图像。 Is there any javascript/jquery function or css code to do that? 有没有javascript / jquery函数或css代码呢? I've read a lot of stuff and nothing should solve my problem. 我已经阅读了很多东西,没有什么可以解决我的问题。

you can use @media print 你可以使用@media print

ex: 例如:

@media print {
  header {
    display: none
  }
  footer > img {
    display: block
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM