I tried several methods but none seems to work properly. I have a html report and I need to print the report with header and footer in every page. I need this working in firefox!
Solution 1:
<html>
<head>
<title></title>
<style type="text/css">
@media print {
#footer {
display: block;
position: fixed;
bottom: 0;
}
}
</style>
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th style="width:100%"> header content </th>
</tr>
</thead>
<tfoot>
<tr>
<td width="100%"><table width="100%" border="0">
<tr>
<td colspan="4"><br>
</td>
</tr>
</table>
</tfoot>
<tbody>
<tr>
<td width="100%"> main content </td>
</tr>
</tbody>
</table>
<table id="footer" width="100%">
<tr>
<td width="100%"> footer content </td>
</tr>
</table>
</body>
</html>
Solution 1 problems: The main content overlies the footer.
Solution 2:
<html>
<head>
<title></title>
<style type="text/css">
@media print {
thead {
display: table-header-group;
}
tfoot {
display: table-footer-group;
}
}
@media screen {
thead {
display: block;
}
tfoot {
display: block;
}
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<td>header content</td>
</tr>
</thead>
<tbody>
<tr>
<td> main content </td>
</tr>
</tbody>
<tfoot>
<tr>
<td>footer content</td>
</tr>
</tfoot>
</table>
</body>
</html>
Solution 2 problems: The footer stays just below the main content, not always in the bottom of the page as I wish.
Any help or other solution?
Thanks
Ok, I found a solution for my problem. I’ll put it here for those who have the same problem.
In my first example we just have to assign tfoot the height we want for the footer.
For example:
Or assign one class and put the height you want.