簡體   English   中英

沒有導航欄的自舉粘頁腳

[英]bootstrap sticky footer without navbar

我在將頁腳停留在頁面底部時遇到了問題,但是當我調整瀏覽器大小時,它只是拒絕停留。

這是代碼http://jsbin.com/piwut/2/

JS斌

<div id="wrap">


  <div class="container">
    <div class="page-header">
      <h1>Sticky footer with fixed  navbar</h1>
    </div>
    <p class="lead">Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.  
  </div> <!-- end container -->
<div id="push"></div>
</div> <!-- end wrap -->

<div id="footer">
  <div class="container">
    <p class="text-muted credit"> Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.Example courtesy <a href="http://martinbean.co.uk">Martin Bean</a> and <a href="http://ryanfait.com/sticky-footer/">Ryan Fait</a>.</p>
  </div>
</div> 

CSS:

      /* Sticky footer styles
  -------------------------------------------------- */

  html,
  body {
    height: 100%;
    /* The html and body elements cannot have any padding or margin. */
  }

  /* Wrapper for page content to push down footer */
  #wrap {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    /* Negative indent footer by it's height */
    margin: 0 auto -100px;
  }

  /* Set the fixed height of the footer here */
  #push,
  #footer {
    height: 100px;
  }
  #footer {
    background-color: black;
  }

  /* Lastly, apply responsive CSS fixes as necessary */
  @media (max-width: 767px) {
    #footer {
      margin-left: -20px;
      margin-right: -20px;
      padding-left: 20px;
      padding-right: 20px;
    }
  }

也許您終於找到了ID,但這是我使用的

#footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
}

將此添加到CSS

#footer {
  position: fixed;
}
/* Negative indent footer by it's height */
    margin: 0 auto -100px;

您能解釋一下您要達到的目標嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM