Fixed width CSS bottom header and centered

I'm an iPhone developer basically, I'm a bit of trash in CSS, and I'm trying to create a web page for my application.

I want my footer to have the following properties:

  • Fixed Width 640px
  • In the center
  • Attached to the bottom of the screen , not to the page. Therefore, when the user resizes the window, the footer is always at the bottom.

All the other styles that I can do myself are just a positional style, which is very difficult for me to find.

Can someone please explain to me how to do this only in CSS.

+5
source share
2 answers
footer {
    width: 640px;
    margin: 0% -320px;
    position: fixed;
    left: 50%;
    bottom: 0%;
}

: http://jsbin.com/imisig/3

: http://jsbin.com/imisig/4

+11

HTML- <div id="footer">. CSS :

#footer {
    width: 640px;
    position: fixed;
    bottom: 0px;
    left: 50%;
    margin-left: -320px;
}

  • width 640px
  • position: fixed ,
  • bottom: 0px ( = 0px)
  • left: 50% div
  • margin-left: -320px - 320 , .
+1

All Articles