How can I force my footer to stick to the bottom of any page in CSS?

前端 未结 10 1058
谎友^
谎友^ 2020-12-16 10:52

This is my code:

#footer {
   font-size: 10px;
   position:absolute;
   bottom:0;
   background:#ffffff;
}

I\'ve no idea what is wrong with

10条回答
  •  甜味超标
    2020-12-16 11:23

    You're probably looking for this example:

    Your content here

    CSS:

    For a 142-pixel footer

    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/
    
    */
    

提交回复
热议问题