所以我有bootstrap navbar這是固定的,並有身體填充頂部:50px; 到目前爲止這麼好,但bootstrap.js和.css文件使得點擊李背景色爲白色,我希望它是黑色的我猜默認值是white.So我試圖手動更改.active的背景顏色屬性類bootstrap導航欄更改主動李背景顏色手動
HTML:
<header>
<nav class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><img id="logo-img" src="images/logo.png" alt="logo"></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#"><span class="glyphicon glyphicon-search"></span> Search</a></li>
<li><a href="#"><span class="glyphicon glyphicon-home"></span> Sales</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="fa fa-cogs"></span> Services</a></li>
<li><a href="#"><span class="glyphicon glyphicon-comment"></span> Contact</a></li>
<li><a href="#"><span class="glyphicon glyphicon-link"></span> About Us</a></li>
</ul>
</div>
</div>
</nav>
</header>
在自定義CSS我有,但沒有任何反應它不會從白到黑的改變:
.active {
background-color: black !important;
}
嘗試改變導航欄類.. [http://www.w3schools.com/bootstrap/tryit.asp ?filename = trybs_navbar_inverse&stacked = h] – SR1092