Bootstrap 3 Flush footer to bottom. not fixed

前端 未结 13 2680
走了就别回头了
走了就别回头了 2020-12-02 04:07

I am using Bootstrap 3 for a site I am designing.

I want to have a footer like this sample. Sample

Please note that I don\'t want it FIXED so bootstrap navba

13条回答
  •  醉梦人生
    2020-12-02 04:29

    There is a simplified solution from bootstrap here (where you don't need to create a new class): http://getbootstrap.com/examples/sticky-footer-navbar/

    When you open that page, right click on a browser and "View Source" and open the sticky-footer-navbar.css file (http://getbootstrap.com/examples/sticky-footer-navbar/sticky-footer-navbar.css)

    you can see that you only need this CSS

    /* Sticky footer styles
    -------------------------------------------------- */
    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;
    }
    

    for this HTML

    
        ...
        
            
            
    ...

提交回复
热议问题