css footer not displaying at the bottom of the page

后端 未结 9 1419
攒了一身酷
攒了一身酷 2021-01-31 21:56

this is my code for my footer, how can i make it display at the bottom of the page rather than right underneath my content above it?

/*footer */
#footer .column          


        
9条回答
  •  北海茫月
    2021-01-31 22:28

    Bootstrap have an example of a footer that sticks to the bottom of the page here: https://getbootstrap.com/examples/sticky-footer/

    Here is the CSS:

    html {
      position: relative;
      min-height: 100%;
    }
    body {
      /* Margin bottom by footer height */
      margin-bottom: 60px;
    }
    .footer {
      position: absolute;
      bottom: 0;
      width: 100%;
      /* Set the fixed height of the footer here */
      height: 60px;
      background-color: #f5f5f5;
    }
    

    Then in the HTML:

提交回复
热议问题