在html中删除页眉和页脚以打印页面 [英] Remove header and footer in html to print page

查看:157
本文介绍了在html中删除页眉和页脚以打印页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有任何方法来删除HTML页面的页眉和页脚,所以如果用户打印它,没有页眉和页脚。

Is there any way to remove header and footer of a html page, so that if user print it, there is no header and footer.

用户可以选择使用打印设置将其删除,但我想知道是否有任何css或javascript以编程方式删除它?

User can choose to remove it using print setup, but i wondering is there any css or javascript to remove it programatically?

推荐答案

您可以这样做:

   @media print
   {
      .noprint { display: none; }
   }

现在您可以应用 noprint class to要在打印时隐藏的元素。

Now you can apply the noprint class to element you want to hide in printing.

这篇关于在html中删除页眉和页脚以打印页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆