如何更改TB导航栏的背景颜色?查看http://twitter.github.com/bootstrap/index.html上的顶部导航栏。当我在navbar.navbar-inverse.navbar-fixed-top
上设置background-color: pink;
时,没有任何反应。我试图在其他元素上做同样的事情。我似乎无法改变颜色。Twitter Bootstrap - 静态导航栏
回答
添加以下CSS和变化颜色。您需要更改:#222222
(较深的颜色)和#111111
(较浅的颜色),因为它们位于背景渐变的不同端。你需要改变它们。 更改#1b1b1b
和#252525
之间的东西。
.navbar-inverse .navbar-inner {
background-color: #1b1b1b;
background-image: -moz-linear-gradient(top, #222222, #111111);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));
background-image: -webkit-linear-gradient(top, #222222, #111111);
background-image: -o-linear-gradient(top, #222222, #111111);
background-image: linear-gradient(to bottom, #222222, #111111);
background-repeat: repeat-x;
border-color: #252525;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);
}
.navbar-inverse .nav .active > a, .navbar-inverse .nav .active > a:hover, .navbar-inverse .nav .active > a:focus {
color: #ffffff;
background-color: #111111;
}
如果你不想梯度,只是做以下并更改#1b1b1b
和#252525
你的背景颜色分别边框颜色和#111111
为“选择”的颜色。
.navbar-inverse .navbar-inner {
background-color: #1b1b1b;
background-image: none;
border-color: #252525;
filter: none;
}
.navbar-inverse .nav .active > a, .navbar-inverse .nav .active > a:hover, .navbar-inverse .nav .active > a:focus {
color: #ffffff;
background-color: #111111;
}
我不明白。为什么我需要设置这么多的属性?不应该背景颜色不够? – StackOverflowNewbie
所有这些属性都存在的原因是支持渐变的外观和感觉。编辑它们不需要的情况。 – mccannf
顺便说一句,如果你正在调整你的引导主题,我会建议看看这个工具:http://pikock.github.com/bootstrap-magic/ – mccannf
我修改使用bootstrap.css后装入一个单独的样式表,其包括
.navbar {
background-color: #2a2a86; /* fallback color, place your own */
/* Gradients for modern browsers, replace as you see fit */
background-image: -moz-linear-gradient(top, #3a3a96, #2a2a86);
background-image: -ms-linear-gradient(top, #3a3a96, #2a2a86);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#3a3a96), to(#2a2a86));
background-image: -webkit-linear-gradient(top, #3a3a96, #2a2a86);
background-image: -o-linear-gradient(top, #3a3a96, #2a2a86);
background-image: linear-gradient(top, #3a3a96, #2a2a86);
background-repeat: repeat-x;
/* IE8-9 gradient filter */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3a3a96', endColorstr='#2a2a86', GradientType=0);
}
然后可以应用相同的逻辑来按钮等等的NAV-栏。
对我来说似乎基色设定在基类的元素,所以
.navbar
.btn
等
- 1. 纯色导航栏Twitter Bootstrap
- 2. Twitter Bootstrap - 右侧导航栏
- 3. Twitter Bootstrap导航栏问题
- 4. Bootstrap静态导航栏滚动
- 5. Twitter Bootstrap导航栏折叠重叠导航栏标题
- 6. Twitter Bootstrap 3.0.3导航栏对齐导航栏标题
- 7. 导航栏下的Twitter-Bootstrap区域
- 8. Twitter Bootstrap 3导航栏崩溃错误
- 9. Glyphicon和Select in twitter bootstrap导航栏
- 10. Twitter-bootstrap导航栏div元素
- 11. Twitter bootstrap侧栏导航词缀
- 12. twitter bootstrap导航栏固定在左侧?
- 13. Twitter Bootstrap:导航栏顶部的徽标?
- 14. Twitter Bootstrap 3导航栏不响应
- 15. Twitter Bootstrap导航栏下拉样式
- 16. Twitter Bootstrap导航栏菜单滚动
- 17. Twitter Bootstrap和移动导航栏
- 18. Twitter-Bootstrap导航栏高度太小
- 19. 将Twitter Bootstrap导航栏与XenForo集成
- 20. 导航栏旁边的Twitter Bootstrap徽标
- 21. Twitter Bootstrap导航栏 - 右对齐控件
- 22. Twitter Bootstrap - 响应式导航栏
- 23. Twitter bootstrap导航栏下拉框
- 24. HTML静态侧导航栏
- 25. Bootstrap导航栏
- 26. Bootstrap导航栏
- 27. Bootstrap导航栏:导航栏 - 右
- 28. Bootstrap:固定导航栏上的静态顶部,但滚动导航崩溃
- 29. Bootstrap 3.2导航栏
- 30. Bootstrap Multi导航栏
我认为它是附加了背景属性的.navbar内部元素。它有一个背景色和一个css渐变背景图片。 –