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