我已经使用twitter引导框架很长一段时间了,他们最近更新到版本3!
我有麻烦让粘性页脚粘到底部,我已经使用了twitter bootstrap网站提供的启动器模板,但仍然没有运气,有什么想法吗?
我已经使用twitter引导框架很长一段时间了,他们最近更新到版本3!
我有麻烦让粘性页脚粘到底部,我已经使用了twitter bootstrap网站提供的启动器模板,但仍然没有运气,有什么想法吗?
当前回答
这里有一个方法,将添加一个粘脚,不需要任何额外的CSS或Javascript,除了什么已经在Bootstrap,不会干扰你当前的页脚。
示例:Easy Sticky Footer
只需复制并粘贴到您的代码。不吵闹不混乱。
<div class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<p class="navbar-text pull-left">© 2014 - Site Built By Mr. M.
<a href="http://tinyurl.com/tbvalid" target="_blank" >HTML 5 Validation</a>
</p>
<a href="http://youtu.be/zJahlKPCL9g" class="navbar-btn btn-danger btn pull-right">
<span class="glyphicon glyphicon-star"></span> Subscribe on YouTube</a>
</div>
</div>
其他回答
当前版本的bootstrap似乎不再适用于这个函数了。如果你下载了他们的sticky-footer-navbar的例子,并在主体区域放置了大量的内容,footer将被向下推过视口的底部。它一点也不粘。
这是一个非常简单和干净的粘性页脚,你可以在bootstrap中使用。完全响应!
HTML
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="Brand" src="">
</a>
</div>
</div>
</nav>
<footer></footer>
</body>
</html>
CSS
html {
position: relative;
min-height: 100%;
}
body {
margin: 0 0 100px;
}
footer {
position: absolute;
left: 0;
bottom: 0;
height: 100px;
width: 100%;
background-color: red;
}
示例:CodePen Demo
# myfooter { 高度:3他们; background - color: # f5f5f5; text-align:中心; padding-top: 1 em; } <页脚> < div class = "脚注" > <div class="容器流体" id="myfooter"> < div class = "行" > < div class = " col-md-12”> <p class="copy">版权所有;你的话< / p > < / div > < / div > < / div > < / div > > < /页脚
推div应该在包装后,而不是在..就像这样
<div id="wrap">
*content goes here*
</div>
<div id="push">
</div>
<div id="footer">
<div class="container credit">
</div>
<div class="container">
<p class="muted credit">© Your Page 2013</p>
</div>
</div>
用Haml & Sass的话说就是:
Haml for app/view/layouts/application.html.haml
%html
%head
%body
Some body stuff
%footer
footer content
app/assets/stylesheet /application.css.sass
$footer-height: 110px
html
position: relative
min-height: 100%
body
margin-bottom: $footer-height
body > footer
position: absolute
bottom: 0
width: 100%
height: $footer-height
基于http://getbootstrap.com/examples/sticky-footer-navbar/