Old Pedant
03-09-2009, 06:30 AM
I have tried to simplify this HTML page down to a reasonable level that will still illustrate my problem.
I have purposely given the various <DIV>s colored borders and interiors to make them easy to find and see. In the actual page, none would have any borders or background colors.
The HTML shown here displays the same--except for the obvious font size differences, etc.--in MSIE and FF. It works adequately.
The only "TRICK" is in the placement of the footer. Note that it is *INSIDE* the <div id="Content"> where the Content is the right column of the page. By using "left: -250px;" this effectively moves the full-width footer to the left side of the page, as desired, while making sure it's at the bottom of everything.
*** BUT ***
But on SOME pages, where I want to use the same CSS, the Navigation DIV is larger (taller) than the Content DIV. And then, not surprisingly, the footer covers over part of the Navigation DIV. It's clearly no longer a real footer.
It wouldn't be a big deal to adjust accordingly--put the footer into the Navigation DIV with a left of 0px--except that I can NOT predict when this situation will happen! (The Navigation height is consistent, but the Content height will vary widely.)
So...the question is simple: What is the right way to use CSS to force that footer to the bottom under all circumstances???
(You can either drop all but one line of the content or add stuff to the nav to see what I'm talking about if it's not obvious.)
Yes, I tried several combinations of "position: relative;" in place of all the "position: absolute;" specs. None helped. Some (not surprisingly) made it worse (that is, would put the content below the nav, etc.).
Will be happy to add any enclosure divs or whatever to make this come out right.
Thanks for looking.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
div#Head { position: absolute; top: 0px; left: 0px; width: 800px; height: 110px;
border: solid blue 2px; background-color: lightblue; }
div#Main { position: absolute; top: 110px; left: 0px; width: 800px;
border: solid red 2px; background-color: pink; }
div#Navigation { position: absolute; top: 0px; left: 0px; width: 200px; vertical-align: top;
border: solid green 2px; background-color: lightgreen; }
div#Content { position: absolute; top: 0px; left: 250px; width: 550px; vertical-align: top;
border: solid orange 2px; background-color: yellow; }
div#foot { position: relative; bottom: 0px; left: -250px; width: 800px;
border: solid black 2px; background-color: lightgrey; }
</style>
</head>
<body>
<div id="Head"><br>This goes in the head</div>
<div id="Main">
<div id="Navigation">
<ul>
<li>Various</li>
<li>Nav</li>
<li>Links</li>
<li>Go</li>
<li>Here</li>
</ul>
</div><!-- navigation -->
<div id="Content">
Lots of content lines here with this one especially long line to see what happens...word wrap at right place or not?<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
** END OF CONTENT **
<div id="foot">footer goes here</div>
</div><!-- content -->
</div><!-- main -->
</body>
</html>
As a side note, why does MSIE make the width of the Content div 800 pixels when it's clearly specified as 550px?? Mind you, it makes the width of the text content therein only 550px, and since I won't be using border or backgroud, it's quite usable for me, as is. But it's sure weird.
p.s.: Please, please, save me from using a <TABLE> instead of <DIV>s. <grin/>
I have purposely given the various <DIV>s colored borders and interiors to make them easy to find and see. In the actual page, none would have any borders or background colors.
The HTML shown here displays the same--except for the obvious font size differences, etc.--in MSIE and FF. It works adequately.
The only "TRICK" is in the placement of the footer. Note that it is *INSIDE* the <div id="Content"> where the Content is the right column of the page. By using "left: -250px;" this effectively moves the full-width footer to the left side of the page, as desired, while making sure it's at the bottom of everything.
*** BUT ***
But on SOME pages, where I want to use the same CSS, the Navigation DIV is larger (taller) than the Content DIV. And then, not surprisingly, the footer covers over part of the Navigation DIV. It's clearly no longer a real footer.
It wouldn't be a big deal to adjust accordingly--put the footer into the Navigation DIV with a left of 0px--except that I can NOT predict when this situation will happen! (The Navigation height is consistent, but the Content height will vary widely.)
So...the question is simple: What is the right way to use CSS to force that footer to the bottom under all circumstances???
(You can either drop all but one line of the content or add stuff to the nav to see what I'm talking about if it's not obvious.)
Yes, I tried several combinations of "position: relative;" in place of all the "position: absolute;" specs. None helped. Some (not surprisingly) made it worse (that is, would put the content below the nav, etc.).
Will be happy to add any enclosure divs or whatever to make this come out right.
Thanks for looking.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
div#Head { position: absolute; top: 0px; left: 0px; width: 800px; height: 110px;
border: solid blue 2px; background-color: lightblue; }
div#Main { position: absolute; top: 110px; left: 0px; width: 800px;
border: solid red 2px; background-color: pink; }
div#Navigation { position: absolute; top: 0px; left: 0px; width: 200px; vertical-align: top;
border: solid green 2px; background-color: lightgreen; }
div#Content { position: absolute; top: 0px; left: 250px; width: 550px; vertical-align: top;
border: solid orange 2px; background-color: yellow; }
div#foot { position: relative; bottom: 0px; left: -250px; width: 800px;
border: solid black 2px; background-color: lightgrey; }
</style>
</head>
<body>
<div id="Head"><br>This goes in the head</div>
<div id="Main">
<div id="Navigation">
<ul>
<li>Various</li>
<li>Nav</li>
<li>Links</li>
<li>Go</li>
<li>Here</li>
</ul>
</div><!-- navigation -->
<div id="Content">
Lots of content lines here with this one especially long line to see what happens...word wrap at right place or not?<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
Lots of content lines here<br><br>
** END OF CONTENT **
<div id="foot">footer goes here</div>
</div><!-- content -->
</div><!-- main -->
</body>
</html>
As a side note, why does MSIE make the width of the Content div 800 pixels when it's clearly specified as 550px?? Mind you, it makes the width of the text content therein only 550px, and since I won't be using border or backgroud, it's quite usable for me, as is. But it's sure weird.
p.s.: Please, please, save me from using a <TABLE> instead of <DIV>s. <grin/>