Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Page Header/Footer in HTML

Page Header/Footer in HTML

Scheduled Pinned Locked Moved XML / XSL
htmltutorial
9 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dotnetquery
    wrote on last edited by
    #1

    Is there a way to put Page Header and Footer in an HTML file. Whie viewing the file it may or may not be displayed, but while printing it should be displayed on each and every page. How to do it. PLease if any suggesstions.

    P D A 3 Replies Last reply
    0
    • D dotnetquery

      Is there a way to put Page Header and Footer in an HTML file. Whie viewing the file it may or may not be displayed, but while printing it should be displayed on each and every page. How to do it. PLease if any suggesstions.

      P Offline
      P Offline
      Phil Hobgen
      wrote on last edited by
      #2

      Hi, This is really something that you probably need to do using CSS, with an alternate stylesheet - CSS2 has some support for print layout and there are moves to improve on this, but I'm not sure what the current browsers support. You could do it with XSLT (if your source is XML), and generate different pages for browsing/printing, but this would be v. complex I suspect. You could even use XSLF for generating a PDF for strict layour printing, I would think this can get even more complex. Unless you're really in to XSL .... I think your best bet is to have a search for articles on css printing. Cheers Phil Hobgen barbari.co.uk Southampton, UK

      1 Reply Last reply
      0
      • D dotnetquery

        Is there a way to put Page Header and Footer in an HTML file. Whie viewing the file it may or may not be displayed, but while printing it should be displayed on each and every page. How to do it. PLease if any suggesstions.

        D Offline
        D Offline
        DavidNohejl
        wrote on last edited by
        #3

        hi there, I seriously doubt there is CSS support for this. Wait for CSS3 ;) Well, assuming you have similar structure for all your pages (let say it starts with paragraph of CSS class MyP), you can easily specify something like @media print { MyP:before{ content:'header'; position:absolute; left:0; top:0; } } For details look at w3c.org... hope it helps David Never forget: "Stay kul and happy" (I.A.)

        D 1 Reply Last reply
        0
        • D DavidNohejl

          hi there, I seriously doubt there is CSS support for this. Wait for CSS3 ;) Well, assuming you have similar structure for all your pages (let say it starts with paragraph of CSS class MyP), you can easily specify something like @media print { MyP:before{ content:'header'; position:absolute; left:0; top:0; } } For details look at w3c.org... hope it helps David Never forget: "Stay kul and happy" (I.A.)

          D Offline
          D Offline
          dotnetquery
          wrote on last edited by
          #4

          Hi, Thnaks for ur valuable guidance. But I am currently using IE-6 and I am trying out something like: @page { margin: 10%; @page-top { margin-right: 5%; text-align: right; content: "Header"; } } Now I want that this text "Header" should be printed as header on each and every page as header. Now do we need to say class="@page" or something like that to apply this style sheet. Help.

          D 1 Reply Last reply
          0
          • D dotnetquery

            Hi, Thnaks for ur valuable guidance. But I am currently using IE-6 and I am trying out something like: @page { margin: 10%; @page-top { margin-right: 5%; text-align: right; content: "Header"; } } Now I want that this text "Header" should be printed as header on each and every page as header. Now do we need to say class="@page" or something like that to apply this style sheet. Help.

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #5

            hi, dotnetquery wrote: But I am currently using IE-6 :doh: I start to think that I completely misunderstood your problem... Are you talking about same header & footer as where IE shows page number, filename etc.? AFAK that's not HTML or CSS thing... I guess it's browser feature... Possibly there is script / ActiveX or something... quick Google search found this[^] keep your eye on this thread[^] As for your CSS style, there is CSS that appears to work for me (in FF)- it should add text to the beginning of every page... anyway I don't know if this is what you are looking for. Nevermind, IE appereantly does NOT support it :((

            <style type="text/css">
            
                 body:before
                {
                  content: "Header";
                  font-weight:bold;
                  position:absolute;
                  left:0;
                  top:0;
                }
            </style>
            

            best regards, David Never forget: "Stay kul and happy" (I.A.)

            D 1 Reply Last reply
            0
            • D DavidNohejl

              hi, dotnetquery wrote: But I am currently using IE-6 :doh: I start to think that I completely misunderstood your problem... Are you talking about same header & footer as where IE shows page number, filename etc.? AFAK that's not HTML or CSS thing... I guess it's browser feature... Possibly there is script / ActiveX or something... quick Google search found this[^] keep your eye on this thread[^] As for your CSS style, there is CSS that appears to work for me (in FF)- it should add text to the beginning of every page... anyway I don't know if this is what you are looking for. Nevermind, IE appereantly does NOT support it :((

              <style type="text/css">
              
                   body:before
                  {
                    content: "Header";
                    font-weight:bold;
                    position:absolute;
                    left:0;
                    top:0;
                  }
              </style>
              

              best regards, David Never forget: "Stay kul and happy" (I.A.)

              D Offline
              D Offline
              dotnetquery
              wrote on last edited by
              #6

              Hi, I tried implementing this code in my file containing a table with data spanning two pages. But when I tried to view the print preview of it, it showed me header only on the first page and not every page. If I modify the tag as body:after, the text moves to the last after the table gets finished and not on every page. Also is it possible to modify the text that we can modify from page setup, with the help of scripts or ActiveX. Also I want to have images as Headers and footers instead of text.

              D 1 Reply Last reply
              0
              • D dotnetquery

                Hi, I tried implementing this code in my file containing a table with data spanning two pages. But when I tried to view the print preview of it, it showed me header only on the first page and not every page. If I modify the tag as body:after, the text moves to the last after the table gets finished and not on every page. Also is it possible to modify the text that we can modify from page setup, with the help of scripts or ActiveX. Also I want to have images as Headers and footers instead of text.

                D Offline
                D Offline
                DavidNohejl
                wrote on last edited by
                #7

                dotnetquery wrote: I tried implementing this code in my file containing a table with data spanning two pages. But when I tried to view the print preview of it, it showed me header only on the first page and not every page. If I modify the tag as body:after, the text moves to the last after the table gets finished and not on every page yeah, that's actually expected result :-O As I admited in last post, I misunderstood your intention.. was more thinking about web page footer (page= like file/document) and missed part "should be displayed on each and every page." IMO that's not job for current CSS. dotnetquery wrote: Also is it possible to modify the text that we can modify from page setup, with the help of scripts or ActiveX. I belive it is. try google or MSDN, since we are talking about IE features here. I don't have experiences with it :( dotnetquery wrote: Also I want to have images as Headers and footers instead of text. :omg: Have you seen it somewhere? I doubt it is possible... I still don't have a clear picture of what you are doing, maybe you should consider other formats then HTML... p.s you see that? two more posts and we'll get 2000th :cool: David Never forget: "Stay kul and happy" (I.A.)

                1 Reply Last reply
                0
                • D dotnetquery

                  Is there a way to put Page Header and Footer in an HTML file. Whie viewing the file it may or may not be displayed, but while printing it should be displayed on each and every page. How to do it. PLease if any suggesstions.

                  A Offline
                  A Offline
                  Abuhijleh
                  wrote on last edited by
                  #8

                  You can do that with CSS2 you have to use the media type, Define a media type of 'Print' for the header and footer and set visibility: none you can find a full details http://www.w3schools.com/css/css\_mediatypes.asp

                  D 1 Reply Last reply
                  0
                  • A Abuhijleh

                    You can do that with CSS2 you have to use the media type, Define a media type of 'Print' for the header and footer and set visibility: none you can find a full details http://www.w3schools.com/css/css\_mediatypes.asp

                    D Offline
                    D Offline
                    DavidNohejl
                    wrote on last edited by
                    #9

                    clickety[^] Also, I got impression that he wants to set header/footer like IE does - you know, place where is url and page title etc. - visible in page preview mode. sorry, I had to steal 2000th post:-> David Never forget: "Stay kul and happy" (I.A.)

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups