【问题标题】:Bootstrap 3 background navbar-default using sassBootstrap 3后台导航栏默认使用sass
【发布时间】:2014-07-29 16:28:10
【问题描述】:

我正在为我的项目使用 bootstrap-sass,但在更改导航背景时遇到问题。

我创建了一个 myStyle.scss 文件

// nav bar
$navbar-default-bg: #0056ff;

@import "../public/lib/bootstrap-sass-official/assets/stylesheets/bootstrap";

并使用 grunt 将 myStyle.scss 和 bootstrap.scss 编译为 style.css 和 bootstrap.css

不幸的是,这不会改变我的应用程序中的标题颜色。检查它拾取的 css

.navbar-default {
   background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
   background-image:      -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
}

它仍然使用引导默认导航栏默认颜色(在 bootstrap-theme.css 中)。我不知道如何改变这一点。我检查了 _theme.scss,它给出了

.navbar-default {
   @include gradient-vertical($start-color: lighten($navbar-default-bg, 10%),  $end-color: $navbar-default-bg);
 ...
 }

看来应该是自动捡起来的……

我的 sass 设置有什么问题吗?我在 bootstrap-sass 页面上发现

bootstrap-sass 要求 Sass 数字的最小精度为 10(默认为 5)。

::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max

但我不清楚在哪里执行此操作(我使用的是 ubuntu)。

有什么建议吗?

干杯, 迈克

【问题讨论】:

    标签: css twitter-bootstrap sass navbar


    【解决方案1】:

    在包含中添加主题就可以了 $navbar-default-bg: #0056ff;

    @import "../public/lib/bootstrap-sass-official/assets/stylesheets/bootstrap";
    @import "../public/lib/bootstrap-sass-official/assets/stylesheets/bootstrap/theme";
    

    【讨论】:

      猜你喜欢
      • 2016-08-14
      • 1970-01-01
      • 1970-01-01
      • 2013-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-19
      相关资源
      最近更新 更多