如何从Internet Explorer中的打印页中删除页眉和页脚

时间:2019-09-24 22:38:06

标签: css media-queries

下面的代码能够删除chrome和firefox中的页眉和页脚,但不能删除Internet Explorer中的打印页。请让我知道如何在IE浏览器中修复该问题。

@page 
{
  size:  auto;   /* auto is the initial value */
  margin: 0mm;  /* this affects the margin in the printer settings */
}

1 个答案:

答案 0 :(得分:2)

我将使用@media print并使用display: none隐藏页眉和页脚。因此,这类似于以下CSS规则(在样式表的底部):

@media print {
  header, footer { display: none; }
}

如果页眉和页脚元素不在headerfooter标记中,而是位于具有类或ID的DIV中,则必须将headerfooter替换为上面的CSS规则中的那些类或ID。

相关问题