I write this post because someone asked me how to create footer in an asp page. That's the main reason. However, after writing a lot about Sql Server functions (and I don't think I am really finished with that!), I indeed needed a break. Anyway...
Creating a footer for your asp page is very easy. I will show you how to do it with css styles, assuming you have a default.asp page which is your home page, an include named footer.asp which is your footer and an external css.css page containing your styles.
The default.asp page
Your default page should be something like:
That is just a very simple example, complete the code with whatever you want, and save it as default.asp.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<link href="css.css" rel="stylesheet" type="text/css">
This is the main body text of your page
<!--#include file="footer.asp" -->
The footer.asp pageIn the footer.asp page you put the content of your footer. Something like:
Save it as footer.asp.
<td><div align="center">This is the place where you put the footer text</div></td>
As you may have noticed, we used a class named "footer" in our table tag. That is what will style the table.
The css.css fileThe css.css file is where we style the table in the footer.asp page. The code should be:
The code will place the footer at the bottom of the home page with an absolute positioning. Width, height, font-family, font-size and text-decoration can be changed according to your needs.
font-family: Verdana, Arial, Helvetica, sans-serif;
If I want a header?The css style can be easily modified in order to convert your footer in a header. In the above css style, replace:
and you're done.
Enjoy yourself and happy programming!