Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 打印页面中的页眉和页脚?不是Web浏览器的页眉和页脚_Html_Css - Fatal编程技术网

Html 打印页面中的页眉和页脚?不是Web浏览器的页眉和页脚

Html 打印页面中的页眉和页脚?不是Web浏览器的页眉和页脚,html,css,Html,Css,我对即将打印的网页的页眉和页脚有问题。我的自定义页眉和页脚应打印在每页上。页眉打印在页面顶部,这很好,但如果页面内容较少,页脚不会打印在页面底部。页脚是否打印取决于内容 我的代码是:- <html> <head> <meta name="generator" content= "HTML Tidy for Windows (vers 14 February 2006), see www.w3.org"> <link rel='

我对即将打印的网页的页眉和页脚有问题。我的自定义页眉和页脚应打印在每页上。页眉打印在页面顶部,这很好,但如果页面内容较少,页脚不会打印在页面底部。页脚是否打印取决于内容

我的代码是:-

<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 14 February 2006), see www.w3.org">
    <link rel='stylesheet' type='text/css' href='print.css' media='print'>
    <title></title>
  </head>
  <body>
    <table border="0" align="center" width="100%">
      <thead>
        <tr>
          <th align="center" width="100%">
            <font size="5" color="black"><strong>HEADER HERE</strong></font>
          </th>
        </tr>
      </thead>
      <tfoot>
        <tr>
          <td align="center" width="100%">
            <font size="4" color="black"><strong>FOOTER HERE</strong></font>
          </td>
        </tr>
      </tfoot>
      <tbody height="100%">
        <tr>
          <td width="100%">
            CONTENT HERE
          </td>
        </tr>
      </tbody>
    </table>
  </body>
</html>
有谁能建议我怎么做吗?这会很有帮助吗?

因为您有一个print.css,所以只在print.css中编写:

根据您的thead和tfoot可能占据的高度,在表格上使用适当的页边距顶部和页边距底部,以避免可能发生的任何重叠。

由于您有print.css,请仅在print.css中写入:


根据您的thead和tfoot可能占据的高度,在表格上使用适当的页边顶部和页边底部,以避免可能发生的任何重叠。

这是我使用的代码。注意,我正在将Chrome和Safari所需的html和身高设置为100%。经过测试,在IE9、FF、铬合金中工作良好

@media print {
  html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }
  #footer {
    position: absolute;
    bottom: 0;
  }
}

这是我使用的代码。注意,我正在将Chrome和Safari所需的html和身高设置为100%。经过测试,在IE9、FF、铬合金中工作良好

@media print {
  html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }
  #footer {
    position: absolute;
    bottom: 0;
  }
}

请告诉我一个更好的问题。不清楚你的意思。你应该在问题中添加你的CSS。当有很多内容时,你的页脚会被推到第二页吗?是的,页脚打印在下一页,如果内容少于页脚打印在内容下方,但我希望页脚不取决于内容它应该是页脚打印在页面底部请给我帮助请告诉我更好的问题。不清楚你的意思。你应该在问题中添加你的CSS。当有很多内容时,你的页脚会被推到第二页吗?是的,页脚打印在下一页如果内容少于页脚打印在内容下面,但我希望页脚不取决于内容它应该是页脚打印在页面底部请给我帮助页脚只显示在第一页。指定的问题,页脚应在每页上打印页脚仅显示在第一页上。指定的问题,页脚应在每页上打印页脚仅显示在第一页上。指定的问题,页脚应在每页上打印页脚仅显示在第一页上。指定问题,每页应打印页脚
@media print {
  html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }
  #footer {
    position: absolute;
    bottom: 0;
  }
}