Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing Footer at Bottom of Screen [duplicate]

Possible Duplicate:
CSS sticky footer

I had this problem for quite a while now and the problem is with all my footers. Everytime I place in this code syntax:

  <Footer>
    <p class="About">DESIGN BY MICHAEL & CODE BY ROKO</p>
  </Footer>

Footer {
display:block;
position: absolute;
bottom: 0;
width: 100%;
height: 141px;
background: url(../assets/content/footer.png) repeat-x left bottom;
}

The footer is either placed at the bottom but when you scroll, it stay where it is and there footer is pretty much half way up the page, or the text that's supposed to be within' the footer is at the top of the page.

Could anyone please help me? I tried to look up Sticky Footer and the result was still the same...

like image 714
Michael Avatar asked Sep 24 '11 23:09

Michael


People also ask

How do I put the footer at the bottom of the screen?

html. < div id = "footer" >This is a footer. This stays at the bottom of the page.

How do I keep the footer at the bottom when I scroll?

this is possible if your footer has a fixed height. Then you will have the scroll bar above your footer. The #contentWrapper has to have an negative margin in scroll bar height plus your footer height. The #content has to have the same value as top padding, so your content at the top will not be out the page.

How do I keep the footer at the bottom of Flex CSS?

Just add margin-top: auto; to the footer. That will cause it to stick to the bottom of its container.


2 Answers

I do something like this and it works pretty well:

<div class="footer" id="footer">My Footer</div>

#footer
{
    clear: both;
    border: 1px groove #aaaaaa;
    background: blue;
    color: White;
    padding: 0;
    text-align: center;
    vertical-align: middle;
    line-height: normal;
    margin: 0;
    position: fixed;
    bottom: 0px;
    width: 100%;
}

You can see an example here: http://jsfiddle.net/RDuWn/

like image 135
itsmatt Avatar answered Sep 18 '22 17:09

itsmatt


I found this: http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page a while ago and use a similar method

like image 39
Connor Avatar answered Sep 21 '22 17:09

Connor