新手问题 Rails 中使用 Bootstrap 效果请教

hunkguo · March 11, 2013 · Last by ericguo replied at March 17, 2013 · 3419 hits

使用的是 anjlab-bootstrap-rails,基本加入页面代码后,明显在导航栏下少了一行,请问为何,我的前端太弱了,为减少工作量想用 bootstrap,呵呵

/app/assets/stylesheets/bootstrap_and_overrides.css

@import "twitter/bootstrap/bootstrap";

body { padding-top: 60px; } 

@import "twitter/bootstrap/responsive";

我也曾碰到过这个问题,详情看这里。

http://railscasts.com/episodes/328-twitter-bootstrap-basics?view=asciicast

你的 navbar 里有个样式 navbar-fixed-top,如果你不要这个效果去掉即可,如果要,则在 body 上加上一个 padding-top 值

另外,你可以使用 navbar-static-top:

  1. 优势:不用写额外的 padding-top
  2. 局限:不会固定在顶部

#1 楼 @xiaoronglv 谢谢,解决了。。。

#3 楼 @nightire 多谢,这个 navbar-static-top 我还第一次知道…

You need to Sign in before reply, if you don't have an account, please Sign up first.