I'm trying to change the active color (after its clicked it remains twitter's light-blue color) for each tab:
<ul class="nav nav-pills">
<li class="active"><a href="#tab1" data-toggle="tab">Overview</a></li>
<li><a href="#tab2" data-toggle="tab">Sample</a></li>
<li><a href="#tab3" data-toggle="tab">Sample</a></li>
</ul>
(How) can I do this in CSS?
You can supply your own class to the nav-pills
container with your custom color for your active link, that way you can create as many colors as you like without modifying the bootstrap default colors in other sections of your page. Try this:
Markup
<ul class="nav nav-pills red">
<li class="active"><a href="#tab1" data-toggle="tab">Overview</a></li>
<li><a href="#tab2" data-toggle="tab">Sample</a></li>
<li><a href="#tab3" data-toggle="tab">Sample</a></li>
</ul>
And here is the CSS for your custom color:
.red .active a,
.red .active a:hover {
background-color: red;
}
Also, if you prefer to replace the default color for the .active
item in your nav-pills
you can modify the original like so:
.nav-pills > .active > a, .nav-pills > .active > a:hover {
background-color: red;
}