Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
html,body{height:100%;}
.wrapper{position:relative; min-height:100%;}
.header{height:100px; left:0;top:0; background-color:red;}
.content{background-color:blue;}
.footer{position:absolute;left:0;bottom:0; background-color:yellow;height:100px;}
</style>
</head>
<body>


<div class="wrapper">
<div class="header">
This is header
</div>
<div class="content">
This content <br>

</div>

<div class="footer">
this is footer
</div>

</div>

</body>
</html>


What I have tried:

i tried to keep
CSS
.content{
bottom:0; || padding-bottom:100px; || margin-bottom:0px;
background-color:blue;
}
Posted
Updated 31-Mar-16 18:02pm
v2

Try this

HTML
<!DOCTYPE html>
<html>
<head>
<style>
html {height:100%}
 body{height:100%;  position:relative;} 
.header{position:absolute; height:100px; width:100%; left:0;top:0; background-color:red;}
.content{   height:100%;width:100%; background-color:blue; padding-top:110px; color:white;}
.footer{position:absolute;left:0;bottom:0; background-color:yellow;height:100px; width:100%;}
</style>
</head>
<body> 
		<div class="header">
		This is header
		</div>
		<div class="content">
		This content <br> 
		</div>
		 
		<div class="footer">
		this is footer
		</div>
 
 
 
</body>
</html>
 
Share this answer
 
Comments
Waheed Mohammed 28-Mar-16 4:52am    
Thanks alot karthik ... i am from bangalore too.. thanks for ur help
Karthik_Mahalingam 28-Mar-16 4:53am    
welcome, Electronic City :)
Waheed Mohammed 28-Mar-16 5:03am    
what do u do karthik
Karthik_Mahalingam 28-Mar-16 5:27am    
IT, S/W Engg
Waheed Mohammed 28-Mar-16 5:36am    
great karthik... im a freelancer
Perfect Solution for this question i finally found
just keep
.header, .footer{height:20%;}
.content{min-height:80%;}


HTML
!DOCTYPE html>
<html>
<head>
<style>
html,body{height:100%;}
.wrapper{position:relative; min-height:100%;}
.header{height:20%; left:0;top:0; background-color:red;}
.content{background-color:blue;min-height:80%;}
.footer{position:absolute;left:0;bottom:0; background-color:yellow;height:20%;; width:100%;}
</style>
</head>
<body>
 

<div class="wrapper">
<div class="header">
This is header
</div>
<div class="content">
This content <br>
 
</div>
 
<div class="footer">
this is footer
</div>
 
</div>
 
</body>
</html>
 
Share this answer
 

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