What was the problem?The problem that I kept thinking about, was that I needed to create an header and a footer for all the pages. That is not a real problem if you need to do it for a web page (I explained the way to do it in another post), but we are talking about creating headers and footers for printing.
If we create for example a footer using a CSS style that gives it a fixed position, we can see our footer staying at the bottom of our page, as we wanted. However if our content (for example the text of our article) flows over a new page, the text will overlap the footer. That is a problem... well actually two problems.
Two problems actually
First of all, the content of the footer will be unreadable, as well as the overflowing text. Secondly, there will be no margin at the bottom of the page.
While the normal flow of elements, in a web page, is easily controllable, when we insert forced page breaks, or we leave the browser to do the dirt job of creating page breaks, we really need to take control of top and bottom margins, and headers and footers repeated on every page.
The solutionThe solution is quite simple, and it involves the use of tables. We basically need to create 3 tables as follows.
First we create a table head, so that it will be repeated on every page
Then we create the table foot. This will be blank (we add a ) so that the main content will not appear on it.
<table border="0" width="100%">
<th style="width:100%">page header</th>
Then we insert the main part:
<table width="100%" border="0">
<td colspan="4"><br> </td>
Now add the footer. This is what will appear on every page. This footer will appear only on printed media (see the CSS style):
put your text (for example article main body, title etc...)
And that's it. Now we need the styles.
<table id="footer" width="100%">
The CSSI include here only the CSS style needed for the footer (which has an id set to "footer").
Now, we can decide the style for all the other elements (and I leave that to your fantasy!).
The above solution works very well, and creates headers and footers on every printed page. That is very useful when we want to show printable content with a decent content flow.
Let me know if you need more help and if you've found the solution helpful.