views:

222

answers:

3

I'm having a hard time with a simple css snippet for footer text. The footer text must always be at the end of the page and the end of the screen whatever comes later.

A: 
* {
    margin: 0;
}
html, body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
    height: 142px; /* .push must be the same height as .footer */
}

/*

Sticky Footer by Ryan Fait
http://ryanfait.com/

*/
Jakob Stoeck
A: 

Use the bottom property:

#footer
{
    position:absolute;
    bottom:2px;
}
ANaimi
This would position it at the bottom of the viewport. If the page was longer it would not be at the bottom of the page (which the question specific).
David Dorward
It would, if the body tag has position: relative;
gnud
@David yes it would - did you try it? I've used it on several projects. See http://www.w3schools.com/CSS/pr_pos_bottom.asp
ANaimi
A: 

For a working example which you could pick apart I had previously done this exact same thing for a client of ours:

Pushed Down Page - Fixed Position Page

cballou