在项目CSS中添加如下代码,修改其中的background-color的颜色值。
background-color
.navbar-custom { background-color:#28323C; color:#ffffff; border-radius:0; } .navbar-custom .navbar-nav > li > a { color:#fff; } .navbar-custom .navbar-nav > .active > a { color: #ffffff; background-color:transparent; } .navbar-custom .navbar-nav > li > a:hover, .navbar-custom .navbar-nav > li > a:focus, .navbar-custom .navbar-nav > .active > a:hover, .navbar-custom .navbar-nav > .active > a:focus, .navbar-custom .navbar-nav > .open >a { text-decoration: none; background-color: #e74c3c; } .navbar-custom .navbar-brand { color:#eeeeee; } .navbar-custom .navbar-toggle { background-color:#eeeeee; } .navbar-custom .icon-bar { background-color:#28323C; }
然后在导航栏中引用刚才添加的样式。
<div class="container-fluid"> <div class="row-fluid"> <div class="navbar navbar-custom navbar-fixed-top" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/">FLAME</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a href="/">首页</a></li> <li class="active"><a href="/archive.html">归档</a></li> <li class="active"><a href="/categories.html">分类</a></li> <li class="active"><a href="/tags.html">标签</a></li> <li class="active"><a href="/about.html">关于</a></li> </ul> </div> </div> </div> </div>
1,stackoverflow-change-navbar-color-in-twitter-bootstrap-3