Forum Moderators: open

Message Too Old, No Replies

include and asp files, using css and <div> tags

having problems with the footer positioning

         

i like your sleeves

3:54 pm on Jul 11, 2005 (gmt 0)

10+ Year Member



i am redesigning my company's website. it basically consists of a topnavbar (the header, which i've made an include file), content specific to whichever page you're on, and a bottomnavbar (footer) which is an include file. my main problem is that the footer misbehaves. on some pages, it is in the correct position (at the bottom of the page) but on MOST pages, it sits up on top of the header, bumped about 20 pixels to the right of the left side of the browser window.

some of the pages have another file, Layer2, that bumps over the content to make room for a table on the left.

for each page with unique content, i'm making an .asp file that tells which include files to read. see below for sample .asp file.

***i am pasting the whole code because i do not know where the error is. please excuse my ignorance.***

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>About Us</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#E0E3E8">

<!--#include file="topnavbar.inc"-->
<!--#include file="aboutus.inc"-->
<!--#include file="bottomnavbar.inc"-->
</body>
</html>

Below is the css file, style.css that is referenced in each .asp file.
body {
padding-left: 1em;
font-family: Helvetica, Geneva, Arial,
SunSans-Regular, sans-serif;
color: 333333;
background-color: #E0E3E8 }
ul.navbar {
list-style-type: none;
padding: 0;
margin: 0;
position: absolute;
top: 1em;
left: 1em;
width: 9em }
h1 {
font-family: Helvetica, Geneva, Arial,
SunSans-Regular, sans-serif }
ul.navbar li {
background: E0E3E8;
margin: 0.5em 0;
padding: 0.3em;
border-right: 1em solid black }
ul.navbar a {
text-decoration: none }
a:link {
color: 333333 }
a:visited {
color: 666666 }
address {
margin-top: 1em;
padding-top: 1em;
border-top: thin dotted }


#header {
position:relative;
left:-1;
top:-1;
}
#content {
position:absolute;
left:8;
top:143;
}
#Layer2 {
position:absolute;
left:211;
top:143;
}
#footer {
position:relative;
left:-1;
top:-1;
clear:all;
}

in the content include files, there is only one <div> tag and one </div> tag. there is no positioning used in these tags [anymore] because i have it in my css now.

<div id="content" style="width:800px; height:140px; z-index:0; overflow: visible;">

above is how i have the opening <div> tag for most pages.

does anyone have any idea what i'm doing incorrectly? i feel like it must be a simple solution, but i'm not seeing it. the footer is in the appropriate position on just a few pages, and i don't see any difference in the .asp or the .inc pages of those that work and those that don't work.

i apologize for this message being so long. i really need help, and i will appreciate any help you can give.

i have looked at several threads concerning <div> tags and css, and i have gone through many tutorials online for css, but i have been unable to find my mistake.

thank you in advance.

tedster

4:49 pm on Jul 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the forums.

It sounds like on the the pages where the footer "misbehaves" there is a probem with the html - divs improperly nested, or tags left open, or what have you. You could only see this properly when all the include files are written in. So I suggest you use the validators first:

W3C Validator - HTML [validator.w3.org]
W3C Validator - CSS [jigsaw.w3.org]

...and then when you are sre the code is valid, if the page is still not displaying as you wish, look the the full source code exactly as it comes to the user agent (use View Source) to pinpoint the problem.

i like your sleeves

6:13 pm on Jul 11, 2005 (gmt 0)

10+ Year Member



thanks for your response, tedster. as you suggested, i used both validators, and i made the minimal changes necessary to make the homepage validate. however, the footer is now about 8 pixels down from the top of the page. (it's no longer bumped to the right, which is good . . . )

any ideas how i could get the footer to actually be a footer, at the bottom of the page?

thanks!

Trace

6:33 pm on Jul 11, 2005 (gmt 0)

10+ Year Member



Here is how I would do it:

<html>
<head>
<title>About Us</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#E0E3E8">
<table cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
<td height="50">
<!--#include file="topnavbar.inc"-->
</td><td height="100%">
<!--#include file="aboutus.inc"-->
</td><td height="50">
<!--#include file="bottomnavbar.inc"-->
</td>
</tr>
</table>
</body>
</html>

You'll have to play around with the different heights, but that's the basic idea.

i like your sleeves

7:02 pm on Jul 11, 2005 (gmt 0)

10+ Year Member



trace, thanks for your response. i must not quite understand your suggestion, though. i changed the code to be similar to yours (only i inserted the pixel heights of the header and the footer - would this be correct?), but the footer came down only 100 or so pixels. Also, everything has been bumped down and to the right. The header should sit in the upper left corner.

any idea what is wrong? i'll paste the code for the asp file for the homepage below.

<html>
<head>
<title>company name</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#E0E3E8" background="images/home-boxes.jpg">
<table cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
<td height="140px">
<!--#include file="topnavbar.inc"-->
</td><td height="100%">
<!--#include file="home.inc"-->
</td><td height="23px">
<!--#include file="bottomnavbar.inc"-->
</td>
</tr>
</table>
</body>
</html>

when i view source, the footer appears at the bottom of the code, as it should appear in browsers, but it doesn't. everything in the source code looks correct . . . it's just this silly footer.

i like your sleeves

2:12 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



Anyone have any ideas? Please help!

Trace

3:54 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



Sorry, what I had typed out before was completely wrong. Try this instead:

<html>
<head>
<title>company name</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#E0E3E8" background="images/home-boxes.jpg">
<table cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
<td height="140px">
<!--#include file="topnavbar.inc"-->
</td>
</tr><tr>
<td height="100%">
<!--#include file="home.inc"-->
</td>
</tr><tr>
<td height="23px">
<!--#include file="bottomnavbar.inc"-->
</td>
</tr>
</table>
</body>
</html>

Sorry about that.

i like your sleeves

8:00 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



thank you, trace, i tried what you suggested.

i can see that it works because it moves the footer with the resizing of the browser window, but do you know how i could get control over the positioning of this table? it's bumped everything down and to the right. AND it jumps the "content" down below the rollover menus when you roll over them. Have you encountered this before? [this is in mac ie 5.2; in other mac browsers and in pc ie 6.0.29, the footer is under the header, on top of the content]

i have been pulling my hair out trying everything i can think of! please help!

i like your sleeves

12:53 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



any ideas? please!

Trace

1:06 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



Seems like your problem is in the files that you are including. I would try removing the includes, then adding them back one by one to find which one is the problem.

Go from there.

Sorry, can't be of any more help to you.

encyclo

1:59 pm on Jul 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, i like your sleeves.

I think the problem is related to the fact that you are using two different methods for positioning elements on the page which are not necessarily compatible. Trace has suggested using a simple table-based grid with which to organize the different sections of your page, whereas you are already using absolute positioning in your CSS. The problem with absolute positioning is that it takes the positioned element out of the normal document flow, so non-positioned elements can sometimes appear too high and behind the positioned ones.

I would start with Trace's basic grid, and then comment out your positioning CSS: surround it with /* and */ . From what you get, you can selectively uncomment parts of your CSS to see what happens.

It is important to note, too, that there remain several syntax errors in your CSS, including the missing units. In Trace's example grid you should remove the

px
units as they are only required in CSS. You should also add a doctype to the very first line of the document (before the
<html>
tag). I would suggest this one:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Then you can use the HTML and CSS validators as listed in tedster's post above.

Let us know how you get on!

i like your sleeves

8:00 pm on Jul 19, 2005 (gmt 0)

10+ Year Member



just wanted to let you know that i did get it to work. i had to remove my <div> tags from all of my include files and put them in the main .asp page. then i had to nest the footer <div> inside the <div> of the content (in the asp page).

the strange thing was that the pages validated correctly (both html and css) but looked so wrong. it should have worked the way i had it, but i just had to change the location of the divs.

the pages still validate both html and css.

i appreciate the help from you both!