清除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.

有没有办法删除html页面的页眉和页脚,这样如果用户打印它,就没有页眉和页脚了。

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

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

thank you for any response.

谢谢你的回复。

3 个解决方案

#1

0

You can do like:

你能做的:

@media print

{

.noprint { display: none; }

}

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

现在可以将noprint类应用到要隐藏在打印中的元素。

#2

4

I do some googling and everybody said: "Can't remove them!" except using ActiveX and 3rd party plugins.

我用谷歌搜索了一下,大家都说:“不能删除它们!”除了使用ActiveX和第三方插件。

I wonder why some reporting controls (Telerik Reporting, DevX,...) can hide Header & Footer without using ActiveX or plugins! Are they print the page in another ways? What way?

我想知道为什么有些报表控件(Telerik reporting, DevX,…)可以在不使用ActiveX或插件的情况下隐藏页眉和页脚!他们以其他方式打印页面吗?什么方式呢?

#3

3

You seem to be referring to the header and footer lines that the browser is adding and not contents of the printed page. In that case the answer is: No, you can only change it in the settings.

您似乎指的是浏览器正在添加的页眉和页脚行,而不是打印页面的内容。在这种情况下,答案是:不,您只能在设置中更改它。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值