springtime
05-25-2008, 04:28 AM
I've simplified what I was trying to do earlier with my previous question. I now have a more straightforward layout with a footer that is positioned at the bottom of the browser window, thanks to this method: http://www.themaninblue.com/writing/perspective/2005/08/29/
If the page content is longer than the browser window, the footer moves with it. That's all good.
I have one small outstanding problem. If the content of my "content" div is shorter than the browser window, I still need that div's bgcolor to extend down to the top of the footer. Right now, the div ends with its content. What am I doing wrong? In this case, how can I make the white color of the "content" div extend all the way down to the footer, even if that portion is empty of content? I know there has to be an easy fix to this... thank you in advance, for any tips!!!
Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
html
{
height: 100%;
}
body {
background-color: #FF9D00;
margin:0;
height:100%
}
#nonFooter
{
position: relative;
min-height: 100%;
}
* html #nonFooter
{
height: 100%;
}
#topsection{
width:100%;
background: #000000;
height: 84px;
margin: 0;
text-align:center
}
#content {
margin-left: auto;
margin-right: auto;
width: 760px;
text-align: left;
background-color:#FFFFFF;
padding-left:15px;
padding-right:15px;
padding-top:10px;
padding-bottom:70px;
}
#footer{
width:100%;
background: #000000;
position: relative;
margin-top: -50px;
text-align:center;
height:50px
}
-->
</style>
</head>
<body>
<div id="nonFooter">
<div id="topsection"></div>
<div id="content">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas lobortis nulla eu metus. Aenean vel erat eu mi tristique accumsan. Cras massa. Sed ut dolor. Donec hendrerit dui eu odio pellentesque aliquet. Fusce adipiscing. Pellentesque odio augue, tincidunt a, congue sit amet, tempor eget, massa. Donec quis nibh id magna porta fermentum. Vivamus eu nisi ac velit viverra pulvinar. Donec cursus, felis id mattis condimentum, sem nisi pharetra metus, tempor sodales nunc leo eu neque. Fusce felis neque, volutpat eget, vehicula in, commodo ac, magna. Sed porttitor porttitor magna. Donec tempor felis sit amet felis.</p>
</div>
</div>
<div id="footer"> </div>
</body>
</html>
If the page content is longer than the browser window, the footer moves with it. That's all good.
I have one small outstanding problem. If the content of my "content" div is shorter than the browser window, I still need that div's bgcolor to extend down to the top of the footer. Right now, the div ends with its content. What am I doing wrong? In this case, how can I make the white color of the "content" div extend all the way down to the footer, even if that portion is empty of content? I know there has to be an easy fix to this... thank you in advance, for any tips!!!
Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
html
{
height: 100%;
}
body {
background-color: #FF9D00;
margin:0;
height:100%
}
#nonFooter
{
position: relative;
min-height: 100%;
}
* html #nonFooter
{
height: 100%;
}
#topsection{
width:100%;
background: #000000;
height: 84px;
margin: 0;
text-align:center
}
#content {
margin-left: auto;
margin-right: auto;
width: 760px;
text-align: left;
background-color:#FFFFFF;
padding-left:15px;
padding-right:15px;
padding-top:10px;
padding-bottom:70px;
}
#footer{
width:100%;
background: #000000;
position: relative;
margin-top: -50px;
text-align:center;
height:50px
}
-->
</style>
</head>
<body>
<div id="nonFooter">
<div id="topsection"></div>
<div id="content">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas lobortis nulla eu metus. Aenean vel erat eu mi tristique accumsan. Cras massa. Sed ut dolor. Donec hendrerit dui eu odio pellentesque aliquet. Fusce adipiscing. Pellentesque odio augue, tincidunt a, congue sit amet, tempor eget, massa. Donec quis nibh id magna porta fermentum. Vivamus eu nisi ac velit viverra pulvinar. Donec cursus, felis id mattis condimentum, sem nisi pharetra metus, tempor sodales nunc leo eu neque. Fusce felis neque, volutpat eget, vehicula in, commodo ac, magna. Sed porttitor porttitor magna. Donec tempor felis sit amet felis.</p>
</div>
</div>
<div id="footer"> </div>
</body>
</html>