css - Bootstrap 3 背景导航栏默认使用 sass

标签 css twitter-bootstrap sass navbar

我正在为我的元素使用 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 默认导航栏默认颜色(在 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)。

有什么建议吗?

干杯, 迈克

最佳答案

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

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

关于css - Bootstrap 3 背景导航栏默认使用 sass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25005059/

相关文章:

css - SCSS伪:after and "class" with ampersand

CSS 菜单未正确对齐

javascript - 从 html 获取图像尺寸

jquery - 带有事件/非事件箭头按钮的子元素 Onclick 的平滑滚动

javascript - Bootstrap 中的面板滚动

variables - 在 Sass 中动态创建或引用变量

css - 绝对定位遵循什么层次

html - 自定义 Bootstrap Forms 2.4.0 的复选框(和一般元素)

html - Bootstrap 侧导航栏

css - Sass:对具有特定类的 body 标签使用 Ampersand '&'