treehouse : what would you like to learn today?
Web Design Web Development iOS Development

How to get a header and footer on HTML?

  • Hi,
    I have an assignment in which I generate an Application Form for Print purposes. The information(thus number of pages) on the Application Form varies from user to user. So sometimes, the Application print is 1 page long, sometimes 2 pages and sometimes even more.

    Now my client is asking me to put a standard header and footer on the page, which should get printed with each page. For example, if the print of the Application Form is coming 1 page long, there would be 1 header and 1 footer.
    If it is coming out to be more that 1 page long, then there should be 1 header and 1 footer on each page which is printed.

    I tried few approaches (using simple HTML), but failed.

    Please let me know if there is any way to accomplish this task.

    Pawan Pillai
    India
  • I have not personally done this or tested it, but I imagine with some testing you could work this out:

    If you have an image that is the height of the printed page, you can repeat-y that as a background image
    body {background: url('image/location.gif') repeat-y top center}


    That should repeat on the vertical access and be at the top of every page... as a background image.

    (What is the height of a page to a printer?... yea that's what needs to be figured out... is there a set height for all browsers?... more testing or maybe Google?)

    That's what I would try.
  • Could this be used with the tags page-break-before and page-break-after perhaps? I've not worked with print type CSS before so haven't really looked at those elements...
  • "AshtonSanders" said:
    I have not personally done this or tested it, but I imagine with some testing you could work this out:

    If you have an image that is the height of the printed page, you can repeat-y that as a background image
    body {background: url('image/location.gif') repeat-y top center}


    That should repeat on the vertical access and be at the top of every page... as a background image.

    (What is the height of a page to a printer?... yea that's what needs to be figured out... is there a set height for all browsers?... more testing or maybe Google?)

    That's what I would try.


    Thanks Ashton,
    Looks like a logical solution. I will try this.
    Only problem could be the print page length.

    Thanks
    Pawan Pillai