Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Thanks in advance for your attention.

I have a html layout with a footer div. I need the footer div to show on bottom of the page if the contents of the webpage don't overflow it. In case the contents of th webpage overflow 100% the height of the webpage, then it's ok for the footer to be pushed further down.

I appreciate your help much!


The CSS and divs follow:

CSS
<style type="text/css">
html
{
	height:100%
}

body 
{ 
	margin: 0 0 0 0px;
	min-height:100%;
}

#headerdiv
{	
	background:#000000;
	width:100%;
	height:150px;
}

#headersubmenudiv
{
	background:#333333;
	width:100%;
	height:50px;
}

#leftstripdiv
{
	background:#666666;
	height:100%;
	width:20%;
	float:left;
}

#centerstripdiv
{
	background:#999999;
	height:100%;
	width:60%;
	display:inline-block;
}

#rightstripdiv
{
	background:#AAAAAA;
	height:100%;
	width:20%;
	float:right;
}

#footerstripdiv
{
	background:#CCCCCC;
	height:50px;
	width:100%;	
}
</style>


HTML
<div id="headerdiv"></div>
<div id="headersubmenudiv"></div>
<div id="leftstripdiv"></div>
<div id="centerstripdiv"></div>
<div id="rightstripdiv"></div>
<div id="footerstripdiv"></div>
Posted
Comments
Homero Rivera 6-Dec-14 23:27pm    
Bonus, a great song: https://www.youtube.com/watch?v=EnAD_KULFBo&index=1&list=RDEnAD_KULFBo

1 solution

Try this:
CSS
#footerstripdiv
{
    background:#CCCCCC;
    height:50px;
    width:100%;
    position: fixed;
    bottom: 0;
}

Read more: Absolute, Relative, Fixed Positioning: How Do They Differ?[^]
 
Share this answer
 
v3
Comments
Homero Rivera 6-Dec-14 23:37pm    
This is great, I will accept as solution but it'd be good to wait and see if somebody else wants to post something else so I can get more knowledge. Accepting as solution now will remove question from 'unanswered' section u know. Thank you Sir!
Homero Rivera 6-Dec-14 23:38pm    
Never mind my dumbass comment.
Peter Leow 6-Dec-14 23:46pm    
I have added a link to more info on positioning in CSS.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900