This is what I found out:
You can use
position: fixed and
top: 0 or
bottom: 0 to position an element in top/bottom of each page. However, since fixed positioning does not work on IE6, the only choice for that is to use a table with
100% height and
tfoot. It is some sort of magic that works the way you want it to (to have the contents of
tfoot to appear on each page). If you don’t care about IE6 just use fixed positioning.
However, fixed positioning also means that any content you have there may go behind the fixed positioned element. So, in effect, the header and the footer does not occupy any space.
You can’t control the actual header/footer (e.g. the URL that is printed). The user has to disable those himself/herself.
The best alternative to painful HTML/CSS printing is PDF. You can control how each page look like, what’s the size of them and header/footer. The drawbacks are slower prints (generating PDF is not as fast as loading a HTML page) and the pain of working your way with some PDF library.