Reputation: 12730
I'm trying to make fixed header and footer visible at the bottom of the screen/page all times.
Main code below works fine if the header is not fixed. If enable this little part in css, footer gets messed up. If I don't then header doesn't get fixed.
/*
width: 100%;
position: fixed;
top: 0px;
z-index: 1;
*/
Is there any chance help modifying mode?
Examples looked: 1, 2, 3 and some others.
Thanks in advance
CSS:
*
{
margin: 0px;
padding: 0px;
}
html, body
{
height: 100%;
font-family: Verdana,Geneva,'DejaVu Sans',sans-serif;
font-size: 12px;
color: #333333;
background: #BABABA;
}
#container
{
min-height: 100%;
position: relative;
}
#header
{
display: block;
/*
width: 100%;
position: fixed;
top: 0px;
z-index: 1;
*/
padding: 10px 10px 11px 10px;
color: #FFFFFF;
background: #000000;
}
#body
{
display: block;
margin-top: 40px;
padding: 10px;
padding-bottom: 40px;
/*background: #ff0000;*/
}
#footer
{
display: block;
position: absolute;
bottom: 0px;
width: 100%;
height: 20px;
border-top: 1px solid #EEEEEE;
padding: 9px 0px 3px 0px;
text-align: center;
font-size: 10px;
text-align: center;
color: #777777;
background: #000000;
}
HTML:
<div id="container">
<div id="header">
HEADER
</div>
<div id="body">
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
<p>Hello</p><br />
</div>
<div id="footer">
FOOTER
</div>
</div>
Upvotes: 0
Views: 1676
Reputation: 196
So, you don't want your footer to be fixed, but it doesn't touch the bottom of the screen ?
If that's your problem, you should do this :
#header{
height: 40px;
}
#container{
padding-top: 40px;
}
If you want you footer to be displayed on the bottom of the page, you should just set his position to fixed
#footer{
position: fixed;
}
Upvotes: 1