We help IT Professionals succeed at work.

Footer Rises/Grows when there is little Content

Henry Starcher
on
I have a template that I am working with that has a footer that sticks to the bottom of the page. However, when there is a small amount of content on the page the footer seems to grow to cover that empty space.

I'm wanting to know if there is a way to stop this from happening. I want my footer to remain at the bottom of the page and not expand.

I have attached a picture of what is happening and the code of my template.

Here is the image:
extending footer
HTML
 
<body>

<div class="wrapper row1">
<div id="global">
<!--webbot bot="Include" u-include="Includes/global.htm" tag="Body" -->
</div>
</div>

<div class="wrapper row2">
<div id="header">
<div id="logo">
<p class="sitename">Your Business Name</p>
<p class="slogan">Slogan or Tag Line Goes Here</p>
</div>
<img alt="sample image" src="images/sample100.jpg" />
<img alt="sample image" src="images/sample100.jpg" />
<img alt="sample image" src="images/sample100.jpg" />
</div>
</div>

<div class="wrapper row3">
<div id="mainnav">
<!--webbot bot="Include" u-include="Includes/mainnav.htm" tag="Body" -->
</div>
</div>

<div class="wrapper row4">
<div id="content">
<!-- #BeginEditable "content" -->
<div class="contentright2">
<h1>Title Goes Here &lt;h1&gt;</h1>
<p>Your content goes here. This block is the width of two columns and can be used as the main content area. 
&lt;div class=&quot;contentright2&quot;&gt;</p>
</div>
<div class="contentleft">
<h3>Heading 3</h3>
<p>Your content goes here. 1 column floated to the left can used as a sidebar. &lt;div class=&quot;contentleft&quot;&gt;</p>
</div>
<!-- #EndEditable -->
<div class="clearcontent"></div>
</div>
</div>

<div class="wrapper row5">
<div id="footer">
<!--webbot bot="Include" u-include="Includes/global.htm" tag="Body" -->
<p>Your Site Name &copy; 2010 | All Rights Reserved | Design by <a href="http://www.rtbwizards.com">RTBWizards.com</a></p>
<p><br />
<img alt="" src="images/blogger-32x32.png" width="32" height="32" />
<img alt="" src="images/facebook-32x32.png" width="32" height="32" />
<img alt="" src="images/twitter-32x32.png" width="32" height="32" />
<img alt="" src="images/wordpress-32x32.png" width="32" height="32" />
<img alt="" src="images/rss-32x32.png" width="32" height="32" /></p>
</div>
</div>

</body>

Open in new window


CSS
 
/*////////// GENERAL RULES //////////*/

html {
height: 101%;
margin-bottom: 1px;}

body {
background-color: #202020; 
color: #000000;
text-align: left;
font: normal 0.80em Verdana, Verdana, Geneva, sans-serif;
padding: 0;
margin: 0;}

hr {
background-color: #a0a0a0;
color: #a0a0a0;
border: none;
height: 2px;}

table {
padding: 0;
border-collapse: collapse;
font-size: 100%;
width: 100%;}

/*////////// TYPOGRAPHY //////////*/

a {
color: #2585bf;
text-decoration: underline;
outline: none;
font-weight: bold;}

a:hover {
color: #909090;
text-decoration: underline;
font-weight: bold;}

h1 {
color: #19577d;
font: normal 30px "Palatino Linotype", Palatino, Georgia, Times, "Times New Roman", serif;
margin: 0 0 .5em 0;
padding: 0 0 5px 0;}

h2 {
color: #19577d;
font: normal 20px Tahoma, Verdana, Geneva, sans-serif;
letter-spacing: 2px;
margin: .8em 0;
padding: 0 0 6px 0;
text-align: left;
border-bottom: 2px #a0a0a0 solid;}

h3 {
color: #606060;
background-color: #dfdfdf;
font: normal 20px Tahoma, Verdana, Geneva, sans-serif;
letter-spacing: 2px;
margin: .8em 0;
padding: 3px 0 3px 10px;
text-align: left;}

h4 {
color: #19577d;
font: normal 20px Tahoma, Arial, sans-serif;
text-align: left;
line-height: 40px;
letter-spacing: 1px;
padding: 0 0 1px 0;
margin: 0 0 .5em 0;}

h5 {
color: #606060;
font: bold 14px Baskerville, Georgia, Times, "Times New Roman", serif;
margin: .8em 0;
text-transform: uppercase;
text-align: left;}

h6 {
color: #606060;
font: bold 12px Baskerville, Georgia, Times, "Times New Roman", serif;
margin: .8em 0;}

/*////////// PAGE LAYOUT CONTROLS //////////*/

.wrapper {width: 100%; display: block; margin: 0; text-align: left;}

.row1 {background-color: #000000; color: #ffffff;
background: -webkit-gradient(linear, left top, left bottom, from(#444444), to(#000000));
background: -moz-linear-gradient(top,  #444444,  #000000);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444', endColorstr='#000000');
border-bottom: 1px #ffffff solid;
height: 25px;}

.row2 {background-color: #124462; color: #ffffff;
background: -webkit-gradient(linear, left top, left bottom, from(#5eb0e0), to(#124462));
background: -moz-linear-gradient(top,  #5eb0e0,  #124462);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5eb0e0', endColorstr='#124462');
height: 140px;}

.row3 {background-color: #000000; color: #ffffff;
background: -webkit-gradient(linear, left top, left bottom, from(#444444), to(#000000));
background: -moz-linear-gradient(top,  #444444,  #000000);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444', endColorstr='#000000');
border-top: 1px #ffffff solid;
}

.row4 {background-color: #ffffff; color: #000000;}

.row5 {background-color: #202020; color: #ffffff; height: 135px;}

/* ------------ Row 1 Global Area ------------------*/

#global {
position: relative;
width: 960px;
height: 25px;
line-height: 25px;
letter-spacing: 1px;
font-size: 0.85em;
padding: 0;
text-align: right;
margin: 0 auto;}
	
#global ul {
margin: 0; padding: 0;}

#global li {
display: inline;
padding: 5px;
margin: 0 5px;
list-style-type: none;}

#global li a {
font-weight: normal;
color: #ffffff;
text-decoration: none;}

#global li a:hover {
color: #ffffff;
text-decoration: underline;}

/* ------------ Row 2 Header Area ------------------*/

#header {
position: relative;
width: 960px;
height: 140px;
text-align: right;
margin: 0 auto;}

#logo {
position: absolute;
top: 20px;
left: 20px;
z-index: 1;
width: 450px;
height: 100px;
text-align: left;}

.sitename {
font: normal 36px Georgia, Times, "Times New Roman", serif;
color: #fff;
letter-spacing: 3px;
padding: 20px 0 0 0;
margin: 0;}

.slogan {
font: normal 14px Georgia, Times, "Times New Roman", serif;
color: #fff;
letter-spacing: 5px;
padding: 5px 0 0 5px;
margin: 0;}

#header img {
padding: 3px;
background-color: #e0e0e0;
margin: 15px 0 15px 10px;
border: 1px #808080 solid;}

/* ------------ Row 3 Navigation Bar ------------------*/

#mainnav {
position: relative;
display: block;
height: 40px;
width: 960px;
line-height: 40px;
color: #ffffff;
margin: 0 auto;}

#mainnav ul {
margin: 0;
padding: 0;}

#mainnav ul li {
display: inline;
list-style-type: none;
text-align: center;
text-transform: uppercase;}

#mainnav ul li a {
margin: 0 10px;
text-decoration: none;
font-weight: normal;
color: #ffffff;}

#mainnav ul li a:hover {
text-decoration: none;
font-weight: normal;
color: #5eb0e0;}

/* ------------ Row 4 Content Area ------------------*/
	
#content {
position: relative;
display: block;
line-height: 1.7em;
width: 940px;
padding: 10px 0;
margin: 0 auto;}

.contentleft {
float: left;
width: 300px;
margin: 0 10px 0 0;}

.contentmiddle {
float: left;
width: 300px;
margin: 0 10px 0 10px;}

.contentright {
float: right;
width: 300px;
margin: 0 0 0 10px;}

.contentleft2{
float: left;
width: 620px;
margin: 0 10px 0 0;}

.contentright2 {
float: right;
width: 620px;
margin: 0 0 0 10px;}

/* TO CLEAR COLUMNS FROM ABOVE */
.clearcontent {
height: 1px;
line-height: 1px;
margin: 0;
padding: 0;
clear: both;}

/* ------------ Row 5 Footer Area ------------------*/

#footer {
position: relative;
display: block;
text-align: center;
font-size: 0.85em;
clear: both;
width: 940px;
height: 130px;
line-height: 1.5em;
color: #ededed;
letter-spacing: 3px;
margin: 0 auto;
padding: 20px 0;}

#footer ul {
margin: 10px 0 20px 0; 
padding: 0;}

#footer li {
letter-spacing: 2px;
display: inline;
padding: 3px;
margin: 0 15px;
list-style-type: none;}

#footer a, #footer li a {
color: #5eb0e0;
text-decoration: none;}

#footer a:hover, #footer li a:hover {
color: #ffffff;
text-decoration: underline;}

#footer p {
clear: both;}

/*////////// IMAGES //////////*/
img {
border: none;}

.image-border {
background-color: #ffffff;
padding: 3px;
border: 1px #919191 solid;}

.imageleft-noborder {
background-color: #ffffff;
margin: 0 10px 0 0;
float: left;}

.imageright-noborder {
background-color: #ffffff;
margin: 0 0 0 10px;
float: right;}

.imageleft-border {
background-color: #ffffff;
margin: 0 10px 0 0;
padding: 3px;
float: left;
border: 1px #919191 solid;}

.imageright-border {
background-color: #ffffff;
margin: 0 0 0 10px;
padding: 3px;
float: right;
border: 1px #919191 solid;}

/*////////// MISC. CLASSES //////////*/

.center {
text-align: center;}

.right {
text-align: right;}

.clear {
clear: both;}

.clearcontent {
height: 1px;
line-height: 0;
margin: 0;
padding: 0;
clear: both;}

.calendar {
line-height: 1.2em;}

.catalogimages {
vertical-align: middle;
text-align: center;
padding: 5px;
width: 20%;}

.catalogdescription {
line-height: normal;
vertical-align: top;
text-align: left;
padding: 5px;
font-size: 0.90em;
width: 60%;}

.catalogdescription h6 {
color: #124462;
margin: 0;
font: bold 12px Arial, Helvetica, sans-serif;}

.catalogcart {
vertical-align: middle;
text-align: center;
padding: 5px;
width: 20%;}

.gallery {
text-align: center;}

.gallery img {
padding: 5px;
border: 1px #808080 solid;
margin: 5px;}

Open in new window

Comment
Watch Question

LZ1
Top Expert 2011

Commented:
Do you have a live URL? If not, can you post the rendered HTML?  
Henry StarcherConsultant

Author

Commented:
No live page but i've attached the file of the image above as it displayed in html.

index.html
LZ1
Top Expert 2011

Commented:
I know your entire page isn't "wrapped" exactly, however it wouldn't be difficult to do.  Have you seen these types of posts?
http://css-tricks.com/snippets/css/sticky-footer/ 
Top Expert 2013
Commented:
Add a div right after the body tag like this <div id="mainContentBlock">

put the closing </div> right before the footer.

Then in the CSS set a minimum height

#mainContentBlock {min-height:###px}

where ### is the minimum height that you want the content to shrink to.

Henry StarcherConsultant

Author

Commented:
I have seem similar items, however it's not an issue with the sticky footer, it sticks to the bottom of the page okay. It seems that the footer itself grows though when the content of the page doesn't fill up the entire window... see the attached file for what it looks like when there is enough content:

footer
I guess what I'm saying is that I'd rather have some white space in the content area than have a footer that seems to expand to fill half the page...

Explore More ContentExplore courses, solutions, and other research materials related to this topic.