【问题标题】:Rails/Bootstrap: How do I change the black bar at the top?Rails/Bootstrap:如何更改顶部的黑条?
【发布时间】:2013-06-04 17:57:06
【问题描述】:

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

我在自定义导航栏/标题时遇到了困难。虽然更改“示例应用”徽标的字体颜色非常简单(只需更改#logo 下颜色参数的 RGB 设置),但如何更改标题其余部分的参数?如何将该黑条更改为其他颜色,例如深蓝色/绿色/红色/紫色/棕色/等?如何将菜单链接(主页/帮助/注册)的颜色从默认的灰色更改为黄色?还是橙色?还是其他颜色?

【问题讨论】:

    标签: ruby-on-rails twitter-bootstrap customization


    【解决方案1】:

    如果您想更改颜色或自定义 twitter bootstrap 的样式(例如标题、链接等),您可以使用生成器 for twitter bootstrap..

    发电机

    或者如果您不知道样式的类/id 药水,您可以在浏览器上使用检查元素并使用样式的类/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;
    }
    

    引导主题

    你可以看到一些很棒的引导主题here

    【讨论】:

    • 谢谢。这对我有用。潜伏者注意:第一次将背景颜色从黑色更改为其他颜色时,请选择明亮的颜色。如果您选择的颜色太深而难以与黑色区分开来,您会认为您所做的事情不起作用。
    【解决方案2】:
    .navbar {
        .navbar-inner {
            background-color: #2c2c2c;
            background-image: none;
        }
    }
    

    来源Change background color in navbar fixed menu bar Bootstrap

    你也可以看看this

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-07
      • 2015-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多