Click here to Skip to main content
15,886,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all !!!
I have a problem about footer. I have read many topics about this problem . Almost of them, i see they use this code:
css:
CSS
html, body, #container { height: 100%; }
body > #container { height: auto; min-height: 100%; }
#footer {
 clear: both;
 position: relative;
 z-index: 10;
 height: 3em;
 margin-top: -3em;
 background-color:red;
}


html:

XML
<div id="container">
 <div id="content" style="height:1000px;">
 asdasdsa
 </div>
</div>
<div id="footer">My Sticky Footer</div>


With long data , no problem. But when content has no data , it displays scrollbar. It is a little. I think margin-top: -3em; cause it.
How can i fix it ???
Posted
Comments
Thanks7872 11-Jun-13 4:39am    
Not clear what you want....Elaborate what you expected and what you got....Highlight the code which you suspect.
Balasubramanian T 11-Jun-13 5:03am    
sorry i can't understand....

why u are use position: relative in here. question was not clear. try to set height and width properly. it may solve ur issue :)
vbmike 11-Jun-13 13:38pm    
CSS-Tricks has this solution to fixed-footer. See if this is what you are looking for.
html, body, #container { height: 100%; }
#footer {
position:fixed;
left:0px;
bottom:0px;
height:30px;
width:100%;
background:#999;
}

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