2014-02-23 52 views
0

我有一個問題,堅持這個頁腳在我的頁面battom但它只是拒絕堅持當我調整瀏覽器大小。bootstrap粘性頁腳沒有導航欄

這裏是代碼 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; 
    } 
    } 

回答

0

一下添加到CSS

#footer { 
    position: fixed; 
} 
+0

如果我添加此,頁腳dissepear一次我減少瀏覽器窗口垂直。 –

+0

哪個瀏覽器? – Ani

0
/* Negative indent footer by it's height */ 
    margin: 0 auto -100px; 

你能解釋一下你正在努力實現這個什麼??

+0

嗯,我是bootstrap的新手,所以我第一次使用它。我想創建一個完整寬度的頁腳,該頁面緊貼頁面的底部......頁面內容可能因動態生成而有所不同......並且如果頁面內容很小,那麼頁腳應該堅持在瀏覽器... –

1

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

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