Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format headers/footers using CSS 1

Status
Not open for further replies.

sfenx

Programmer
Feb 23, 2001
81
BE
Is there some way to format headers and footers using CSS?
And is it possible to show the footers on each page (on screen and on printpreview)?

Sfenx
 
If you include them with SSI of PHP or some language then they will display everywhere, even when you print. You can format them the same as you would format the page itselfd; AND, you can put the style stuff in with the rest on the main page, not only the page being included.

Rick If I have helped you just click the first link below to let me know :)
 
Rick,
I am using ASP, and as you wrote I can include them without a problem. But this time I need to do the stuff client-side (without server-side languages). Any suggestions?
:cool:
 
Well, here's what I'd do. You can't use frames because you want the headers and footers to scroll. So, there's one way that has never worked for me, but you can try and make it work:
<div style=&quot;include-source:URL(page.html);&quot;></div>
for more info goto:
Otherwise, I'd recommend using Iframes:
<iframe src=&quot;header.html&quot;>I'm the header</iframe>
then the body, then
<iframe src=&quot;footer.html&quot;>I'm the footer</iframe>
It is usable from IE 3+ and NS 6+. It leaves out a couple browsers, but it's the best way I can think of if you can't use server side scripting.

Rick If I have helped you just click the first link below to let me know :)
 
MS FrontPage &quot;Include&quot; pages are portable and you can format the pages as any normal page.
 
Sorry, that should have read:

MS FrontPage &quot;Include&quot; pages are portable and you can format the pages as you would any normal page.
 
Can someone help me out with my code? I can't seem to stop the contents from overwriting the footer. Also my footer appears only once (on the first page). How can I make it appear on each page?
N4.7 shows the message &quot;parameter is incorrect&quot;, in the footer.

thx, Sfenx
My testbrowsers: N4.7 and IE5.

Code:
<HTML>
<HEAD>
<LINK rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen, print&quot; href=&quot;/styles/BriefStijl.css&quot;>
<script language=&quot;JavaScript&quot;>
<!--
function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName==&quot;Netscape&quot;)&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
// -->
</script>

</head>

<BODY>
<DIV class=&quot;header&quot; style=&quot;z-index=0&quot;>
  <TABLE width=&quot;100%&quot; border=&quot;0&quot;>
    <TR>
      <TD>This is my header</td>
    </tr>
  </table>
</div>
<DIV class=&quot;Footer&quot; style=&quot;include-source:url(&quot;somedoc.html&quot;);z-index=2&quot;></div>
<DIV class=&quot;Contents&quot; style=&quot;z-index=1&quot;>
This is the contents
</div>
</body>
</html>

**********/BriefStijl.css

.Contents {
    position: absolute;
    left: 1.6cm;
    right: 1.5cm;
    top: 3.5cm;
    text-align: justify;
    color: blue;
    font-family: tahoma, arial, sans-serif ! important;
    font-size: 10.5pt;
}

.Header {
    position: absolute;
    left: 1.5cm;
    right: 1.5cm;
    top: 0cm;
    bottom: 0cm;
}

.Footer {
    position: absolute;
    left: 1.5cm;
    right: 1.5cm;
    top: 25cm;
    bottom: 0cm;
}

**********/somedoc.html

<TABLE width=&quot;100%&quot; border=&quot;1&quot;>
  <TR>
    <TD>This is my footer</td>
  </tr>
</table>
 
Hi sfenx,
My reference say that the include-source is only Netscape.

If it's your goal then maybe the double quotes occurs the problem

Try single quotes for the url:
style=&quot;include-source:url('somedoc.html');z-index=2&quot;

But why don't you just do it the sam like the header:

<BODY>
<DIV class=&quot;header&quot; style=&quot;z-index=0&quot;>
<TABLE width=&quot;100%&quot; border=&quot;0&quot;>
<TR>
<TD>This is my header</td>
</tr>
</table>
</div>
<DIV class=&quot;Footer&quot; style=&quot;z-index=2&quot;>
<TABLE width=&quot;100%&quot; border=&quot;0&quot;>
<TR>
<TD>This is my footer !!</td>
</tr>
</table>
</div>
<DIV class=&quot;Contents&quot; style=&quot;z-index=1&quot;>
This is the contents
</div>
</body>

Hope this helps,
Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
gph1,
your javascript idea for headers en footers is great, but you still have to enter the code manually every time you need it.
Boomerang,
The include-source doesn't seem to be the problem. Even with single quotes, the result is the same and only Netscape return a 'invalid parameter' message in the footer.
The problem isn't realy the include-source (I can write the code directly in the footer-div) but the fact that the contents (when it's more than one page) overwrites my footer and that the footer isn't repeated on the other pages. A small example of what I have in mind:
-Header (top of page)
-Contents (page1 | from 3.5cm to 24cm on paper)
-Footer (at 25cm on paper)
-Contents (page2 | from 3.5cm to 24cm on paper)
-Footer (at 25cm on paper)
-Contents (page3 | from 3.5cm to 24cm on paper)
-Footer (at 25cm on paper)
... something like the Word interface.
I don't know if this is possible, but any suggestions are welcome.

Sfenx :cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top