Rails/Bootstrap:我如何改变顶部的黑条



railstutorial.org (http://ruby.railstutorial.org/chapters/filling-in-the-layout#top)的第五章讨论了如何创建一个网站的基本布局。我用它作为把Rails网站放在一起的资源。

我在定制导航栏/页眉时有困难。虽然改变字体颜色的"示例应用程序"的标志是足够简单的(只需改变颜色参数的RGB设置#logo),我如何改变参数在头部的其余部分?我如何将黑色条更改为其他颜色,例如深蓝色/绿色/红色/紫色/棕色等?如何将菜单链接(主页/帮助/注册)的颜色从默认的灰色更改为黄色?还是橘子?还是别的颜色?

如果你想改变颜色或自定义twitter引导样式(例如header, link等),你可以使用generator for twitter bootstrap.

发电机

  • 推特引导生成器
  • StyleBootstrap
  • bootstrapthemeroller
  • decioferreira

或者如果你不知道style的class/id位置,你可以在浏览器上使用inspect element来查看style的class/id位置

页眉使用蓝色

.navbar-inner {
    min-height: 50px;
    padding-right: 20px;
    padding-left: 20px;
    background-color: #45aeea;
    background-image: -moz-linear-gradient(top,#54b4eb,#2fa4e7);
    background-image: -webkit-gradient(linear,0 0,0 100%,from(#54b4eb),to(#2fa4e7));
    background-image: -webkit-linear-gradient(top,#54b4eb,#2fa4e7);
    background-image: -o-linear-gradient(top,#54b4eb,#2fa4e7);
    background-image: linear-gradient(to bottom,#54b4eb,#2fa4e7);
    background-repeat: repeat-x;
    border: 1px solid #1990d5;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff54b4eb',endColorstr='#ff2fa4e7',GradientType=0);
    -webkit-box-shadow: 0 1px 4px rgba(0,0,0,0.065);
    -moz-box-shadow: 0 1px 4px rgba(0,0,0,0.065);
    box-shadow: 0 1px 4px rgba(0,0,0,0.065);
   }

链接头使用白色

.navbar .nav>li>a {
   float: none;
   padding: 10px 15px 10px;
   color: #fff;
   text-decoration: none;
   text-shadow: 0 1px 0 #ce4213;
}

引导主题

你可以在这里看到一些很棒的bootstrap主题

.navbar {
    .navbar-inner {
        background-color: #2c2c2c;
        background-image: none;
    }
}
修改导航栏背景色固定菜单栏引导

你也可以看看这个

最新更新