Reputation: 28294
I want to change the background color of my active link to orange in the header. I am using bootstrap and not sure how would I do that. I trield using
ul.nav a:active {
color: orange !important;
}
but that didnt work... any idea? below is my code
<style>
div.navbar.navbar-inverse.navbar-fixed-top{
background-color: #f1f1f1;
border-color: #f1f1f1;
}
</style>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">My-H</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</div>
</div>
Upvotes: 0
Views: 1171
Reputation: 1067
you have <li class="active"><a href="#">Home</a></li>
,your active link (<a>
tag) is placed in a <li>
tag with active
class.so try using this css instead :
ul.nav li.active a {
color: orange !important;
}
Upvotes: 1