我正在为我的元素使用 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/