cscooper
08-27-2005, 08:25 PM
Can anyone help me get #footer to sit on the bottom of the page (mostly concerned with IE for now, but will eventually need a solution for standards-compliant browsers, too).
I've tried:
... position: absolute; bottom: 0; ...
This works OK, for short pages (as seen in the code below), but for longer-length content, the #footer is "stuck" at the bottom of the first fold and not at the bottom of all content.
I've also tried:
... position: relative; bottom: 0; ...
But this only works for longer content pages. Short pages (such as in the example below) have the #footer immediately following the two paragraphs.
To see what I mean, take the code below and add your solution to the CSS, then try adding more or less paragraphs within the #main division.
I just want a solution that will never show browser whitespace at all after the final #footer division.
Here's an example page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bottom Feeder</title>
<style type="text/css">
<!--
* {margin:0;
padding:0;
font-family: georgia;}
div#header { width: 100%;
background: #223;
border-width: 0 0 5px 0;
border: solid #667;}
div#header h1{ color: #fff;
margin-top: 25px;
margin-left: 25px;}
div#sidelinks{ float: left;
margin: 25px 25px 0 10px;
background: #fdf9f1;
border: #d91 solid 3px;}
div#sidelinks * { font-family: "Trebuchet MS";}
div#sidelinks ul{ margin: 10px;}
div#sidelinks ul li{ list-style: none;}
div#sidelinks ul li a:link { text-decoration:none;
color:#223;}
div#sidelinks ul li a:visited { text-decoration:none;
color:#223;}
div#sidelinks ul li a:hover { text-decoration:underline;
color:#667;}
div#main{ width: 600px;
margin: 25px 0 0 0px;}
h1, h2 { font-family: "Trebuchet MS";
width: 700px;}
h2{ color:#c80;}
p{ margin-bottom: 25px}
.super{ font-size:7pt;
color: #888;}
div#footer{ bottom: 0;
width: 100%;
background: #223;
border-width: 5px 0 0 0;
border: solid #667;
height: 40px;}
div#footer p{ color: #fff;
font-size: smaller;
font-family: "Trebuchet MS";
margin-left:25px}
-->
</style>
</head>
<body>
<div id="content">
<div id="header">
<h1>Joe's Bottom Feeder</h1>
</div>
<div id="sidelinks">
<ul>
<li><a href="http://www.amazon.com/">Amazon Books</a></li>
<li><a href="http://www.simplebits.com/">Simple Bits</a></li>
<li><a href="http://www.zewg.com/">Zewg</a></li>
<li><a href="http://www.csszengarden.com/">CSS Zen Garden</a></li>
<li><a href="http://www.forsalebyowner.com/">For Sale By Owner</a></li>
<li><a href="http://www.cssvault.com/">CSS Vault</a></li>
</ul>
</div>
<div id="main">
<h2>Welcome</h2>
<p>You're always welcome at Joe's Bottom Feeder. The site that tries to make sense of CSS positioning.
Specifically we attempt to tackle tricky footer divs — you know, the kind that should live on
the bottom of your page.</p>
<h2>80's Flashback</h2>
<p>I'm not a fan of Spandex<span class="super">®</span> shorts. The shrinkage just doesn't
adequately cover the wearer. Like a good pair of shorts, this page should never shrink smaller
than 100% of the screen height. And should always grow to allow more content.</p>
</div>
<div id="footer">
<p>Copyright ©2005, BottomsUp.</p>
</div>
</div>
</body>
</html>
I've tried:
... position: absolute; bottom: 0; ...
This works OK, for short pages (as seen in the code below), but for longer-length content, the #footer is "stuck" at the bottom of the first fold and not at the bottom of all content.
I've also tried:
... position: relative; bottom: 0; ...
But this only works for longer content pages. Short pages (such as in the example below) have the #footer immediately following the two paragraphs.
To see what I mean, take the code below and add your solution to the CSS, then try adding more or less paragraphs within the #main division.
I just want a solution that will never show browser whitespace at all after the final #footer division.
Here's an example page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bottom Feeder</title>
<style type="text/css">
<!--
* {margin:0;
padding:0;
font-family: georgia;}
div#header { width: 100%;
background: #223;
border-width: 0 0 5px 0;
border: solid #667;}
div#header h1{ color: #fff;
margin-top: 25px;
margin-left: 25px;}
div#sidelinks{ float: left;
margin: 25px 25px 0 10px;
background: #fdf9f1;
border: #d91 solid 3px;}
div#sidelinks * { font-family: "Trebuchet MS";}
div#sidelinks ul{ margin: 10px;}
div#sidelinks ul li{ list-style: none;}
div#sidelinks ul li a:link { text-decoration:none;
color:#223;}
div#sidelinks ul li a:visited { text-decoration:none;
color:#223;}
div#sidelinks ul li a:hover { text-decoration:underline;
color:#667;}
div#main{ width: 600px;
margin: 25px 0 0 0px;}
h1, h2 { font-family: "Trebuchet MS";
width: 700px;}
h2{ color:#c80;}
p{ margin-bottom: 25px}
.super{ font-size:7pt;
color: #888;}
div#footer{ bottom: 0;
width: 100%;
background: #223;
border-width: 5px 0 0 0;
border: solid #667;
height: 40px;}
div#footer p{ color: #fff;
font-size: smaller;
font-family: "Trebuchet MS";
margin-left:25px}
-->
</style>
</head>
<body>
<div id="content">
<div id="header">
<h1>Joe's Bottom Feeder</h1>
</div>
<div id="sidelinks">
<ul>
<li><a href="http://www.amazon.com/">Amazon Books</a></li>
<li><a href="http://www.simplebits.com/">Simple Bits</a></li>
<li><a href="http://www.zewg.com/">Zewg</a></li>
<li><a href="http://www.csszengarden.com/">CSS Zen Garden</a></li>
<li><a href="http://www.forsalebyowner.com/">For Sale By Owner</a></li>
<li><a href="http://www.cssvault.com/">CSS Vault</a></li>
</ul>
</div>
<div id="main">
<h2>Welcome</h2>
<p>You're always welcome at Joe's Bottom Feeder. The site that tries to make sense of CSS positioning.
Specifically we attempt to tackle tricky footer divs — you know, the kind that should live on
the bottom of your page.</p>
<h2>80's Flashback</h2>
<p>I'm not a fan of Spandex<span class="super">®</span> shorts. The shrinkage just doesn't
adequately cover the wearer. Like a good pair of shorts, this page should never shrink smaller
than 100% of the screen height. And should always grow to allow more content.</p>
</div>
<div id="footer">
<p>Copyright ©2005, BottomsUp.</p>
</div>
</div>
</body>
</html>